MySQL Forums
Forum List  »  Performance

Re: Slow Query Time for Many Records from Large Table
Posted by: KimSeong Loh
Date: November 08, 2005 08:05PM

I guess both the query uses the index.

Note that your count(*) returns about 40,000 and the other only 49.

With 40,000 rows having the same value, you will need to check a lot more index nodes than 49 matching rows, so more processing is required.
And more index nodes require more index pages to be read from the disk, of course the key_buffer will help with caching the index pages.

What do you think about doing a simple loop that loops 49 times compared to a loop that loops 40,000 times? Do you expect them to take the same amount of time?

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Slow Query Time for Many Records from Large Table
1345
November 08, 2005 08:05PM


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.