My iPhone app connects to my PHP web service to retrieve data from a MySQL database. A request can return 500 results.
What is the best way to implement paging and r
There's literature about it:
Optimized Pagination using MySQL, making the difference between counting the total amount of rows, and pagination.
Efficient Pagination Using MySQL, by Yahoo Inc. in the Percona Performance Conference 2009. The Percona MySQL team provides it also as a Youtube video: Efficient Pagination Using MySQL (video),
The main problem happens with the usage of large OFFSET
s. They avoid using OFFSET
with a variety of techniques, ranging from id
range selections in the WHERE
clause, to some kind of caching or pre-computing pages.
There are suggested solutions at Use the INDEX, Luke:
"Paging Through Results".
"Pagination done the right way".