MySQL Forums
Forum List  »  Optimizer & Parser

Re: Range query performance question
Posted by: Jay Pipes
Date: February 27, 2006 02:50PM

Camelia Ticau wrote:
> In my opinion, this is a bug:
>
> Why does MySQL need to parse 11191 records, if the
> records are sorted by (recordtype, recordnumber)? Logically,
> locating (recordtype=0, recordnumber=100) should be O(logn)
> for a binary search.

It's not a bug. MySQL is simply telling you that it estimates that 11191 records would meet your WHERE condition. It does not mean that it would process all those records. Only enough to satisfy the LIMIT condition; in this case, at offset 0, for one record.

> If I would do the search manually, I would first
> locate the record for
> (recordtype=0, recordnumber=100), then will will
> take the next record.
>
> Why is MySQL searching for (recordtype=0,
> recordtype>100) so different?

What kind of performance are you seeing from your query?

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Views
Written By
Posted
6526
February 27, 2006 01:52PM
Re: Range query performance question
2567
February 27, 2006 02:50PM


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.