Limit the number of results


When possible, use the LIMIT statement to specify the number of results to return. This helps minimize the amount of CPU and RAM used to find the relevant records.
The improvement in performance will be even greater if the records contain many large fields.

When selecting, if you only want to display the first 25 records of a table containing people’s first and last names, replace the following:

SELECT first_name, last_name FROM people


SELECT first_name, last_name FROM people LIMIT 0,25
This best practice should only be applied if it is coherent with your project's specifications.
Under CC-By-NX-SA license