====================================================================== Step 1: register user and create chat ====================================================================== User already exists, uid = 192f7969-fdb8-4964-b493-84414f282d2b chat_id = 8d21790c-d735-4c00-9896-8766559b8806 ====================================================================== Step 2: bulk-insert 10 000 messages via psql ====================================================================== Message count: 10000 ====================================================================== Step 3: cursor boundary at row 9950 (late page) ====================================================================== cursor_id = 9f1e62d8-ba02-4f1f-9dd9-9df4a608b618 cursor_ts = 2026-11-21T14:39:37.739131+00:00 ====================================================================== Step 4: EXPLAIN ANALYZE — OLD form (OR cursor) ====================================================================== QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.41..8.44 rows=1 width=66) (actual time=0.754..0.760 rows=49 loops=1) Buffers: shared hit=252 -> Index Scan using idx_messages_chat_created_id on messages (cost=0.41..8.44 rows=1 width=66) (actual time=0.753..0.757 rows=49 loops=1) Index Cond: (chat_id = '8d21790c-d735-4c00-9896-8766559b8806'::uuid) Filter: ((created_at > '2026-11-21 14:39:37.739131+00'::timestamp with time zone) OR ((created_at = '2026-11-21 14:39:37.739131+00'::timestamp with time zone) AND (id > '9f1e62d8-ba02-4f1f-9dd9-9df4a608b618'::uuid))) Rows Removed by Filter: 9951 Buffers: shared hit=252 Planning: Buffers: shared hit=117 Planning Time: 0.535 ms Execution Time: 0.786 ms (11 rows) ====================================================================== Step 5: EXPLAIN ANALYZE — NEW form (row-comparison / Index Cond) ====================================================================== QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.41..8.43 rows=1 width=66) (actual time=0.024..0.029 rows=49 loops=1) Buffers: shared hit=5 -> Index Scan using idx_messages_chat_created_id on messages (cost=0.41..8.43 rows=1 width=66) (actual time=0.023..0.026 rows=49 loops=1) Index Cond: ((chat_id = '8d21790c-d735-4c00-9896-8766559b8806'::uuid) AND (ROW(created_at, id) > ROW('2026-11-21 14:39:37.739131+00'::timestamp with time zone, '9f1e62d8-ba02-4f1f-9dd9-9df4a608b618'::uuid))) Buffers: shared hit=5 Planning: Buffers: shared hit=106 Planning Time: 0.562 ms Execution Time: 0.082 ms (9 rows) ====================================================================== Step 6: HTTP timing — late page via API ====================================================================== API cursor (base64url): MjAyNi0xMS0yMVQxNDozOTozNy43MzkxMzErMDA6... API response: 200 in 0.0150s, 49 items