messages=10000 -- first page Limit (cost=0.29..7.72 rows=50 width=32) (actual time=0.021..0.032 rows=50 loops=1) Buffers: shared hit=5 -> Index Scan using ix_messages_history on messages (cost=0.29..1486.70 rows=10000 width=32) (actual time=0.021..0.029 rows=50 loops=1) Index Cond: (chat_id = 'f3c38461-f7ec-49fd-a912-46e9cff8f2b4'::uuid) Buffers: shared hit=5 Planning: Buffers: shared hit=104 Planning Time: 0.210 ms Execution Time: 0.050 ms -- page after row 5000 Limit (cost=0.29..12.22 rows=50 width=32) (actual time=0.016..0.027 rows=50 loops=1) Buffers: shared hit=4 -> Index Scan using ix_messages_history on messages (cost=0.29..1200.23 rows=5027 width=32) (actual time=0.015..0.023 rows=50 loops=1) Index Cond: ((chat_id = 'f3c38461-f7ec-49fd-a912-46e9cff8f2b4'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, 'd063df83-eabe-455a-b0dc-d8e1dfb1364d'::uuid))) Buffers: shared hit=4 Planning: Buffers: shared hit=105 Planning Time: 0.276 ms Execution Time: 0.051 ms