Pagination that survives inserts

Back to list2023-10-24
You

Offset pagination skips rows when new ones arrive.

ChatGPT

Use a keyset: order by a stable column plus the primary key, and pass the last seen values as the cursor. Offsets are computed against a moving table, which is precisely why rows appear twice or vanish.

You

How do I know when it stops being worth it?

ChatGPT

When you stop noticing it. If it has not surfaced a problem in six months, it is either solved or it was never the bottleneck you thought.