The Tiebreaker Clause

You switch the feed to keyset pagination. created_at has only second resolution and a busy account can post several times in the same second, so ties are common. The last row of the page you just served was created_at = '2026-03-01 10:00:00', id = 4821, and there is an index on (created_at, id). Which WHERE clause returns the next page with no gaps and no repeats?

-- A
WHERE created_at < '2026-03-01 10:00:00'

-- B
WHERE created_at <= '2026-03-01 10:00:00'

-- C
WHERE (created_at, id) < ('2026-03-01 10:00:00', 4821)

-- D
WHERE created_at <= '2026-03-01 10:00:00' AND id < 4821

All four are followed by ORDER BY created_at DESC, id DESC LIMIT 20.

A

B

B

C

C

D

D

A