Re: Are there any plans on improving count(*)'s speed?
Posted by:
Rick James
Date: January 19, 2009 04:33PM
Sorry, your query has to read the entire 4.6M rows to get the answer you asked for. While/after scanning it has to sort 4.6M board_ids or hash and lookup 4.6M board_ids, then "ORDER BY difboards DESC", and finally deliver the first 30. MySQL can't beat 3 seconds without you helping it.
One way to help it is to periodically calculate stuff like this.
Another way is to change the UI to be more vague on things like this. Ever notice UIs that say "Page 7 out of more than 100" or "approx 1,000,000 results".
If you think 3 seconds is bad, wait until your data is bigger than will fit in RAM. Then you will be pounding on the disk and possibly taking 3 minutes.
Subject
Views
Written By
Posted
3209
January 19, 2009 03:48AM
Re: Are there any plans on improving count(*)'s speed?
1642
January 19, 2009 04:33PM
1852
January 19, 2009 11:45PM
2180
January 20, 2009 02:17AM
1953
January 21, 2009 07:41PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.