MySQL Data - Best way to implement paging?

后端 未结 7 1115
灰色年华
灰色年华 2020-11-22 09:32

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

7条回答
  •  北海茫月
    2020-11-22 10:31

    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 OFFSETs. 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".

提交回复
热议问题