MySQL Forums
Forum List  »  Performance

Re: optimizing count statement
Posted by: Felix Geerinckx
Date: October 12, 2005 08:01AM

Karolis wrote:
> I have also noticed that mysql can count more rows quickly if there are no table joins.

How does this perform:

SELECT COUNT(*) FROM (
SELECT 1 FROM INDEX_KEYS WHERE KeywordID IN (7, 79) GROUP BY DocumentID HAVING COUNT(DISTINCT KeywordID) = 2) AS x;

> 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?

Nope.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Views
Written By
Posted
3935
October 11, 2005 11:30AM
1836
October 12, 2005 04:56AM
1762
October 12, 2005 06:31AM
1440
October 12, 2005 07:11AM
1640
October 12, 2005 07:40AM
1558
October 12, 2005 07:53AM
1730
October 12, 2005 07:50AM
Re: optimizing count statement
1711
October 12, 2005 08:01AM
1702
October 12, 2005 08:05AM
1434
October 12, 2005 08:23AM
1723
October 12, 2005 08:22AM
1673
October 12, 2005 08:38AM
1801
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.