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?
Introduction to MySQL LIMIT clause
The following illustrates the LIMIT clause syntax with two arguments:
SELECT
select_list
FROM
table_name
LIMIT [offset,] row_count;
offset specifies the offset of the first row to return. The offset of the first row is 0, not 1.row_count specifies the maximum number of rows to return.The following picture illustrates the LIMIT clause:
Therefore, these two clauses are equivalent:
> LIMIT row_count;
> LIMIT 0 , row_count;
The following picture illustrates the evaluation order of the LIMIT clause in the SELECT statement: