LAB2 LEVEL 4 EXPLAIN EVIDENCE
messages in history: 60000, total messages: 112283, deep offset: 30000

=== first page ===
Limit  (cost=0.42..8.42 rows=50 width=141) (actual time=0.021..0.041 rows=50 loops=1)
  Buffers: shared hit=5
  ->  Index Scan using messages_chat_created_id_idx on messages  (cost=0.42..9617.70 rows=60079 width=141) (actual time=0.021..0.038 rows=50 loops=1)
        Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
        Buffers: shared hit=5
Planning:
  Buffers: shared hit=114
Planning Time: 0.270 ms
Execution Time: 0.059 ms

=== keyset page after offset 30000 ===
Limit  (cost=0.42..16.75 rows=50 width=141) (actual time=0.030..0.047 rows=50 loops=1)
  Buffers: shared hit=3 read=1
  ->  Index Scan using messages_chat_created_id_idx on messages  (cost=0.42..7361.33 rows=22536 width=141) (actual time=0.029..0.044 rows=50 loops=1)
        Index Cond: ((chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:30.001+00'::timestamp with time zone, 'e77ba05c-13b1-46a4-ba9f-6f630e60f623'::uuid)))
        Buffers: shared hit=3 read=1
Planning:
  Buffers: shared hit=113
Planning Time: 0.262 ms
Execution Time: 0.075 ms

=== naive OFFSET 30000 ===
Limit  (cost=4802.74..4810.74 rows=50 width=141) (actual time=11.206..11.225 rows=50 loops=1)
  Buffers: shared hit=619
  ->  Index Scan using messages_chat_created_id_idx on messages  (cost=0.42..9617.70 rows=60079 width=141) (actual time=0.020..10.570 rows=30050 loops=1)
        Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
        Buffers: shared hit=619
Planning:
  Buffers: shared hit=114
Planning Time: 0.278 ms
Execution Time: 11.241 ms
