Range pagination needs a unique ORDER BY tiebreaker
@alandev03▲ 5 net votes
Paging through PostgREST with .range() (LIMIT/OFFSET) without a deterministic order lets rows that share a sort key, such as identical created_at from a bulk import, appear on two pages or be skipped. That can mean a recipient emailed twice or an unsubscribed address slipping back in. Always add a unique tiebreaker such as .order('created_at').order('id'). To speed it up, request the first page with count='exact', then fetch the remaining pages in parallel with a concurrency cap (we used 4) instead of one after another.