DEV Community

Discussion on: Server-Side Pagination With Limit/Offset

Collapse
 
dmfay profile image
Dian Fay

One thing to add: OFFSET can still have performance issues at high enough page numbers, since the first n rows still have to be found, sorted, and passed up. There's another technique called keyset or "seek" pagination which performs consistently; it doesn't do well with nulls and you can no longer jump to arbitrary pages, but if you're pulling a list sufficiently long that this is an issue, page numbers are all but meaningless anyway.

graph showing response time with offset pagination climbing as page number increases, compared to keyset pagination response time holding steady

More details from Markus Winand (the chart's his too).