Mysql table scan
i have a table with about 1 million rows in a mysql 5 database. lately i learned that twitter does allow browsing only a certain number of tweets like last 600 or 6000. in my case user can brows开发者_Python百科e to middle, end or begining of the records. from my point of view this functionality is not neessary, should i do what twitter did?
I'd would dinamically set the limit by constantly checking the average load/cpu usage/query time of the database... That way when there are a few users online they can do their work faster. You could set a "maximum" like twitter and if total-load > max-load-you-want maximum=150% and so on...
On one of the service-based sites i've applied this method it actually removed 60% of the spikes after i told the users about the change...
If you have a system with 20 million 190 million active users then maybe.
Refer to this: http://www.mysqlperformanceblog.com/2006/09/01/order-by-limit-performance-optimization/
Beware of large LIMIT ...
... for many web sites failing to take care of this provides very easy task to launch a DOS attack - request page with some large number from few connections and it is enough....
精彩评论