List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 29 1999 2:01am
Subject:Re: LIMIT clause
View as plain text  
At 5:25 PM -0800 1999-12-28, Jose de Leon wrote:
>Does the LIMIT clause in a select actually limit the number of rows actually
>selected or does it limit only the number of rows returned?
>The reason I ask is because I am running a query that is selected over
>100,000 rows but no matter how I specify LIMIT, it always chokes the server.
>If LIMIT only limits rows returned, then how can I get around that and force
>only a small amount of rows selected?

In older versions of MySQL, it acts as a post-processing filter,
so that all the qualifying rows are selected, and it limits only the
number of rows returned.

In more recent versions, the manual indicates that the LIMIT clause
is actually subject to optimization in some cases, which I take to
mean that the server need not in all cases select all the rows that
would be selected without the LIMIT clause.  Check the following
for more information:

Paul DuBois, paul@stripped
LIMIT clauseJose de Leon29 Dec
  • Re: LIMIT clausePaul DuBois29 Dec
  • Re: LIMIT clausehypnos29 Dec