===== keyset_deep_history_index ===== QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=1.16..39.32 rows=50 width=110) (actual time=0.151..0.163 rows=50 loops=1) Buffers: shared hit=14 -> Incremental Sort (cost=1.16..5285.82 rows=6926 width=110) (actual time=0.150..0.159 rows=50 loops=1) Sort Key: created_at, ((id)::text) Presorted Key: created_at Full-sort Groups: 2 Sort Method: quicksort Average Memory: 33kB Peak Memory: 33kB Buffers: shared hit=14 -> Index Scan using messages_history_idx on messages (cost=0.42..4980.14 rows=6926 width=110) (actual time=0.046..0.062 rows=51 loops=1) Index Cond: ((chat_id = 'a65fabe7-45b1-48f8-9e69-1ce146591e08'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:01:00.001+00'::timestamp with time zone, '4040726d-3600-430a-adda-fe4b752b1044'::uuid))) Buffers: shared hit=5 Planning: Buffers: shared hit=127 Planning Time: 0.918 ms Execution Time: 0.262 ms (14 rows) ===== offset_deep_same_chat ===== QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=9985.13..9993.45 rows=50 width=110) (actual time=30.434..30.447 rows=50 loops=1) Buffers: shared hit=1124 -> Incremental Sort (cost=0.61..11646.06 rows=69981 width=110) (actual time=0.143..29.165 rows=60050 loops=1) Sort Key: created_at, ((id)::text) Presorted Key: created_at Full-sort Groups: 1877 Sort Method: quicksort Average Memory: 33kB Peak Memory: 33kB Buffers: shared hit=1124 -> Index Scan using messages_history_idx on messages (cost=0.42..9159.61 rows=69981 width=110) (actual time=0.045..20.330 rows=60051 loops=1) Index Cond: (chat_id = 'a65fabe7-45b1-48f8-9e69-1ce146591e08'::uuid) Buffers: shared hit=1115 Planning: Buffers: shared hit=128 Planning Time: 0.912 ms Execution Time: 30.490 ms (14 rows) ===== keyset_first_page_at_least_10000 ===== QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.74..17.47 rows=50 width=110) (actual time=0.139..0.153 rows=50 loops=1) Buffers: shared hit=14 -> Incremental Sort (cost=0.74..6679.62 rows=19958 width=110) (actual time=0.139..0.150 rows=50 loops=1) Sort Key: created_at, ((id)::text) Presorted Key: created_at Full-sort Groups: 2 Sort Method: quicksort Average Memory: 33kB Peak Memory: 33kB Buffers: shared hit=14 -> Index Scan using messages_history_idx on messages (cost=0.42..5831.91 rows=19958 width=110) (actual time=0.043..0.059 rows=51 loops=1) Index Cond: (chat_id = '09ba6f62-1a1f-449c-89ae-9ca655000b36'::uuid) Buffers: shared hit=5 Planning: Buffers: shared hit=128 Planning Time: 0.918 ms Execution Time: 0.191 ms (14 rows) ===== keyset_deep_created_at_index_only ===== QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (cost=1.04..39.19 rows=50 width=110) (actual time=0.212..0.257 rows=50 loops=1) Buffers: shared hit=11 read=3 -> Incremental Sort (cost=1.04..5352.98 rows=7015 width=110) (actual time=0.211..0.252 rows=50 loops=1) Sort Key: created_at, ((id)::text) Presorted Key: created_at Full-sort Groups: 2 Sort Method: quicksort Average Memory: 33kB Peak Memory: 33kB Buffers: shared hit=11 read=3 -> Index Scan using messages_time_created on messages_time (cost=0.29..5043.54 rows=7015 width=110) (actual time=0.067..0.116 rows=51 loops=1) Index Cond: (created_at >= '2026-01-01 00:01:00.001+00'::timestamp with time zone) Filter: ((chat_id = 'a65fabe7-45b1-48f8-9e69-1ce146591e08'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:01:00.001+00'::timestamp with time zone, '4040726d-3600-430a-adda-fe4b752b1044'::uuid))) Rows Removed by Filter: 1 Buffers: shared hit=2 read=3 Planning: Buffers: shared hit=106 read=1 Planning Time: 1.195 ms Execution Time: 0.391 ms (16 rows)