Is there any major reason why we should use LİMİT when retrieving records? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there any major reason why we should use LİMİT when retrieving records?

15th Feb 2016, 8:49 PM
Kevin Kiambe
Kevin  Kiambe - avatar
2 Answers
+ 7
It works best to prevent the strain on database server by users who only use the query to view few rows. Example: You never go to the second page of google results, so why bother the database with more than what you will use? And I mostly use LIMIT to check if my codes work in smaller row numbers, too. Tables with millions of rows do take time and also some toll on the performance of the working database server. So limiting the query by 100 to check the integrity, then running the code seems more plausible to me. Also Select TOP X columns From table works wonders.
6th Oct 2016, 12:50 PM
Christine Fleming (PyGirl)
Christine Fleming (PyGirl) - avatar
0
Think about this, if you wanna sort out the only three person who score the most in a swiming championship, say u wanna grand them gold, silver, bronze medals, u sort the scores in descending order, then use the SELECT...LIMIT 3
19th Feb 2016, 3:58 PM
PanosChao