Comment on Why You Shouldn’t Use OFFSET and LIMIT For Your Pagination

<- View Parent
lysdexic@programming.dev ⁨9⁩ ⁨months⁩ ago

Having said this, I’d say that OFFSET+LIMIT should never be used, not because of performance concerns, but because it is fundamentally broken.

If you have rows being posted continuously into a table and you try to go through them with OFFSET+LIMIT pagination, the output from a pagination will not correspond to the table’s contents. Fo each row that is appended to the table, your next pagination will include a repeated element from the tail of the previous pagination request.

Things get even messier once you try to page back your history, as now both the tip and the tail of each page will be messed up.

Cursor+based navigation ensures these conflicts do not happen, and also have the nice trait of being easily cacheable.

source
Sort:hotnewtop