When writing a paging request on a web page, what is the least expensive method to get the total number of lines? Is there a way to do this without executing the request twice - one for the total and the next for the limit?
Using MySQL
Example: (I want to know if there is a cheaper way)
Get quantity
SELECT COUNT(*) FROM table
Get paging
SELECT mycolumns FROM table LIMIT 100
How can I get the total score without running 2 requests.
source
share