Offset pagination skips rows when new ones arrive

Back to list2024-08-21
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

What should an API error body contain?

ChatGPT

A stable machine-readable code, a human sentence, and, when the fault is the client's, which field. Stack traces help nobody outside your team, and a bare 400 turns every integration into guesswork.