MySQL Forums
Forum List  »  Optimizer & Parser

Re: Performance of Select (pk) vs Select(*) with order by
Posted by: KimSeong Loh
Date: November 07, 2005 08:53PM

select * from customers order by birthdate limit 99980,20
and
select * from customers order by birthdate limit 100000

should take close to the same time.

Even though you only need 20 rows, it still need to sort and get the first 100000 rows based on the birthdate, to get the last 20 rows in the first 100000 rows.

If you have an index on birthdate, then it might be slightly faster, since no sorting is required with a sorted index.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Performance of Select (pk) vs Select(*) with order by
2278
November 07, 2005 08:53PM


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.