Answer the question
In order to leave comments, you need to log in
MySQL Data Limit
Task: get data from MySQL with a certain limit and offset, find out the number of all elements in the table (that is, without applying limit and offset to it).
The following solution comes to mind: we get all the data without taking into account limit and offset, then, without SQL, we count them and cut them off.
You can, of course, specify limit and offset in the SQL select query, but then you will have to call a separate SQL query to count all elements.
What will be the fastest?
Answer the question
In order to leave comments, you need to log in
Two requests should be made: for data fetching, a request with limit and offset, for quantity - a request without limit and offset, but with the count function (no need to pull data, only count).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question