Rows in test chat: 10000

Position: 0
Limit  (cost=0.29..4.17 rows=51 width=70) (actual time=0.017..0.041 rows=51 loops=1)
  Buffers: shared hit=3
  ->  Index Scan using messages_history on messages  (cost=0.29..762.53 rows=10000 width=70) (actual time=0.016..0.032 rows=51 loops=1)
        Index Cond: (chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid)
        Buffers: shared hit=3
Planning:
  Buffers: shared hit=20
Planning Time: 0.208 ms
Execution Time: 0.065 ms

Position: 5000
Limit  (cost=0.29..5.44 rows=51 width=70) (actual time=0.011..0.023 rows=51 loops=1)
  Buffers: shared hit=4
  ->  Index Scan using messages_history on messages  (cost=0.29..503.80 rows=4981 width=70) (actual time=0.010..0.018 rows=51 loops=1)
        Index Cond: ((chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '670bebbc-8919-425e-8a27-81c9b3bd2180'::uuid)))
        Buffers: shared hit=4
Planning Time: 0.140 ms
Execution Time: 0.053 ms

Position: 9900
Limit  (cost=0.29..68.56 rows=51 width=70) (actual time=0.015..0.028 rows=51 loops=1)
  Buffers: shared hit=3
  ->  Index Scan using messages_history on messages  (cost=0.29..135.50 rows=101 width=70) (actual time=0.014..0.023 rows=51 loops=1)
        Index Cond: ((chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009901+00'::timestamp with time zone, '5d58dc9e-45f6-448f-8316-182dd9f07504'::uuid)))
        Buffers: shared hit=3
Planning Time: 0.079 ms
Execution Time: 0.043 ms
PostgreSQL: 16.8 (Debian 16.8-1.pgdg120+1)
Durability: on on
PASS: actual EXPLAIN ANALYZE BUFFERS at first/middle/tail; API traversal 10000 rows, 100 pages, 2.130s
