As others have mentioned, using
LIMIT ... OFFSET ...
without
ORDER BY
to incrementally fetch rows from a table can result in both missed and duplicate rows because the set of returned rows for each query execution is not guaranteed to be consistent: factors beyond the programmers control determine which rows are returned. Adding an
ORDER BY
that is guaranteed to produce a unique ordering improves the situation, but might not resolve it if concurrent updates to the staging table affect the order of returned rows. —
JohnH just now