MySQL Forums
Forum List  »  Newbie

query limit performance
Posted by: Ed Wong
Date: November 03, 2009 08:09PM

Hi all,
A have a query to obtain the latest 5 items in a table. (no WHERE condition)

explain select name from table order by id desc limit 5;

however, i found that the explain statement shows that it looks at all the rows of the table... i am worry about the performance of such query.

Is it true that even I put a limit there, mysql will still scan all the rows?

please advice. thx

ed

Options: ReplyQuote


Subject
Written By
Posted
query limit performance
November 03, 2009 08:09PM
November 04, 2009 01:38PM
November 04, 2009 04:00PM


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.