Please wait while we load your page...

PasswordSentry

Latest Version [8.00202205221] Last Updated [May-22-2022]

Webmaster Tutorials

Definition [Optimize Performance Using LIMIT]

Protect Your Website Today
Home




Optimize Performance Using LIMIT



Let's say you are searching the database for one row. You can optimize performance by adding LIMIT 1. Instead of scanning the entire database table(s), mySQL will stop scanning after it finds the first one. For example:

SELECT * FROM `users` WHERE `user` = 'jsmith' LIMIT 1

In the case of large database tables, the performance benefit can be large: in terms of time savings, and reduced load on mySQL server.