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