MySQL Forums
Forum List  »  InnoDB

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Are there any plans on improving count(*)'s speed?
1642
January 19, 2009 04:33PM


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.