MySQL Forums
Forum List  »  Performance

Re: optimizing count statement
Posted by: Karolis
Date: October 12, 2005 07:50AM

I presume this could be because MySQL is not able to process bigger amounts of data in RAM, so it has to write it to a disk. That would explain why at some point the query time jumps so quickly. I have also noticed that mysql can count more rows quickly if there are no table joins. Say 6000 instead of 3000.

I might refuse to process queries which will generate more than X results (3000 in this case). The problem is, however, that I have no way to presume how many results mysql is going to find. This is a search engine implementation. It can find 1 result or it can find 100 000 results.

Is there a way to tell count(*) function to stop counting at a certain point? Say if it counts 5000 rows, just return 5000 instead of scanning until the end?

thanks,
Karolis

Options: ReplyQuote


Subject
Views
Written By
Posted
3931
October 11, 2005 11:30AM
1834
October 12, 2005 04:56AM
1760
October 12, 2005 06:31AM
1439
October 12, 2005 07:11AM
1639
October 12, 2005 07:40AM
1557
October 12, 2005 07:53AM
Re: optimizing count statement
1727
October 12, 2005 07:50AM
1710
October 12, 2005 08:01AM
1700
October 12, 2005 08:05AM
1432
October 12, 2005 08:23AM
1721
October 12, 2005 08:22AM
1671
October 12, 2005 08:38AM
1799
October 12, 2005 08:46AM


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.