Good evening,

For example, the user enters the first page, and from the table receives 20 records, goes to the second page and receives the next 20 records. itd do on every page?

LIMIT 0, 20
LIMIT 20, 40 LIMIT 40, 60

Question: How is it easier and usually implemented.

  • What is the problem? - andreymal
  • Feeling that this is not the best option, and there is an alternative. - user3686478 9:39
  • Than this option did not suit you? - andreymal
  • You set the LIMIT values ​​in the form of variables that you multiply by the number of the current page ... That's what they do! - Dimastik86
  • Yes, the option is certainly not the best. And yes, many do, just because of the simplicity of the method. And it works fine when you have a couple thousand entries. If more, then large offsets in limit start to slow down, because MySQL is forced to read all the records from the beginning and throw away those that we skip. As an option - remember the value of the sort key in the last entry on the page and the next one to take where key > x . so it works much faster, but of course more fuss to do it - Mike

0