## none: huge chat (60000 msgs), deep page (90%), API query
Limit  (cost=9183.85..9189.80 rows=51 width=532) (actual time=67.276..87.978 rows=51 loops=1)
  Buffers: shared hit=7367
  ->  Gather Merge  (cost=9183.85..9751.83 rows=4868 width=532) (actual time=67.273..87.966 rows=51 loops=1)
        Workers Planned: 2
        Workers Launched: 2
        Buffers: shared hit=7367
        ->  Sort  (cost=8183.83..8189.91 rows=2434 width=532) (actual time=13.388..13.393 rows=17 loops=3)
              Sort Key: created_at, id
              Sort Method: top-N heapsort  Memory: 85kB
              Buffers: shared hit=7367
              Worker 0:  Sort Method: quicksort  Memory: 25kB
              Worker 1:  Sort Method: quicksort  Memory: 25kB
              ->  Parallel Seq Scan on messages  (cost=0.00..8102.62 rows=2434 width=532) (actual time=0.009..12.206 rows=2000 loops=3)
                    Filter: ((chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid) AND (ROW(created_at, id) > ROW('2026-09-28 01:41:51.032324+00'::timestamp with time zone, 'db8caccb-93cc-4062-b61e-ddeb6b88f5c4'::uuid)))
                    Rows Removed by Filter: 33000
                    Buffers: shared hit=7337
Planning Time: 0.290 ms
Execution Time: 88.155 ms

## chat_id: huge chat (60000 msgs), deep page (90%), API query
Limit  (cost=9260.53..9260.66 rows=51 width=532) (actual time=26.160..26.180 rows=51 loops=1)
  Buffers: shared hit=4248
  ->  Sort  (cost=9260.53..9275.84 rows=6124 width=532) (actual time=26.158..26.170 rows=51 loops=1)
        Sort Key: created_at, id
        Sort Method: top-N heapsort  Memory: 85kB
        Buffers: shared hit=4248
        ->  Bitmap Heap Scan on messages  (cost=668.24..9056.22 rows=6124 width=532) (actual time=5.633..24.171 rows=5999 loops=1)
              Recheck Cond: (chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid)
              Filter: (ROW(created_at, id) > ROW('2026-09-28 01:41:51.032324+00'::timestamp with time zone, 'db8caccb-93cc-4062-b61e-ddeb6b88f5c4'::uuid))
              Rows Removed by Filter: 54001
              Heap Blocks: exact=4194
              Buffers: shared hit=4248
              ->  Bitmap Index Scan on bench_chat_id_idx  (cost=0.00..666.71 rows=60056 width=0) (actual time=4.493..4.493 rows=60000 loops=1)
                    Index Cond: (chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid)
                    Buffers: shared hit=54
Planning Time: 0.143 ms
Execution Time: 26.636 ms

## chat_created_id: huge chat, OFFSET 54000 (NOT used by the API)
Limit  (cost=22459.09..22459.20 rows=1 width=532) (actual time=259.657..291.046 rows=51 loops=1)
  Buffers: shared hit=7425, temp read=3869 written=3991
  ->  Gather Merge  (cost=16653.81..22459.09 rows=49756 width=532) (actual time=171.715..286.418 rows=54051 loops=1)
        Workers Planned: 2
        Workers Launched: 2
        Buffers: shared hit=7425, temp read=3869 written=3991
        ->  Sort  (cost=15653.79..15715.99 rows=24878 width=532) (actual time=124.502..136.749 rows=18090 loops=3)
              Sort Key: created_at, id
              Sort Method: external merge  Disk: 14880kB
              Buffers: shared hit=7425, temp read=3869 written=3991
              Worker 0:  Sort Method: external merge  Disk: 8488kB
              Worker 1:  Sort Method: external merge  Disk: 8472kB
              ->  Parallel Seq Scan on messages  (cost=0.00..7883.88 rows=24878 width=532) (actual time=0.039..16.722 rows=20000 loops=3)
                    Filter: (chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid)
                    Rows Removed by Filter: 15000
                    Buffers: shared hit=7337
Planning Time: 0.145 ms
Execution Time: 311.469 ms

## chat_created_id: huge chat (60000 msgs), deep page (90%), API query
Limit  (cost=0.42..125.73 rows=51 width=532) (actual time=0.062..0.155 rows=51 loops=1)
  Buffers: shared hit=54
  ->  Index Scan using messages_chat_history_idx on messages  (cost=0.42..14974.22 rows=6094 width=532) (actual time=0.061..0.147 rows=51 loops=1)
        Index Cond: ((chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid) AND (ROW(created_at, id) > ROW('2026-09-28 01:41:51.032324+00'::timestamp with time zone, 'db8caccb-93cc-4062-b61e-ddeb6b88f5c4'::uuid)))
        Buffers: shared hit=54
Planning Time: 0.188 ms
Execution Time: 0.264 ms

## covering: huge chat (60000 msgs), deep page (90%), API query
Limit  (cost=0.42..8.67 rows=51 width=529) (actual time=0.077..0.104 rows=51 loops=1)
  Buffers: shared hit=5
  ->  Index Only Scan using bench_history_covering_idx on messages  (cost=0.42..986.22 rows=6090 width=529) (actual time=0.076..0.095 rows=51 loops=1)
        Index Cond: ((chat_id = '58d533ef-79b6-4078-a5b2-286c4076859e'::uuid) AND (ROW(created_at, id) > ROW('2026-09-28 01:41:51.032324+00'::timestamp with time zone, 'db8caccb-93cc-4062-b61e-ddeb6b88f5c4'::uuid)))
        Heap Fetches: 0
        Buffers: shared hit=5
Planning Time: 0.145 ms
Execution Time: 0.187 ms
