Sunday, November 29, 2020

Shouldn’t Use OFFSET and LIMIT For Your Pagination

This is what you should use: 

"Select column1, column2, ..., columnN from table where IDX > 1000 limit 20

Why? Because by explicitly passing the latest read row, you are telling your DB exactly where to start the search base on an efficient indexed key and won't have consider any rows outside of the range.

https://medium.com/swlh/why-you-shouldnt-use-offset-and-limit-for-your-pagination-4440e421ba87