I have 4000 rows for example, and I define X limit.
The query stops after it finds X rows? or the query finds all the rows and then takes X rows from the found rows?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From MySQL Reference Manual:
So it looks like it’s possible that the entire result set is known before the
LIMITis applied. But MySQL will try everything it can not to do so. And you can help it by providing useful indexes that match your queries.EDIT: Furthermore, if the set is not sorted it terminates the
SELECToperation as soon as it’s streamed enough rows to the result set.