=== Lab 2 Grade 4: message history index experiment === === Preparing synthetic benchmark user === INSERT 0 0 === Preparing test chat === INSERT 0 0 INSERT 0 0 === Preparing 20000 messages === INSERT 0 0 === Test data size === message_count --------------- 20000 (1 row) === Refreshing PostgreSQL statistics === ANALYZE === OFFSET pagination after 15000 messages === QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2129.70..2143.90 rows=100 width=82) (actual time=1.883..1.896 rows=100 loops=1) Buffers: shared hit=435 -> Index Scan using ix_messages_chat_created_id on messages (cost=0.41..2839.47 rows=20000 width=82) (actual time=0.020..1.535 rows=15100 loops=1) Index Cond: (chat_id = '22222222-2222-4222-8222-222222222222'::uuid) Buffers: shared hit=435 Planning: Buffers: shared hit=21 Planning Time: 0.094 ms Execution Time: 1.908 ms (9 rows) === KEYSET pagination after message 15000 === QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (cost=0.41..30.01 rows=100 width=82) (actual time=0.008..0.031 rows=100 loops=1) Buffers: shared hit=7 -> Index Scan using ix_messages_chat_created_id on messages (cost=0.41..1481.99 rows=5006 width=82) (actual time=0.007..0.022 rows=100 loops=1) Index Cond: ((chat_id = '22222222-2222-4222-8222-222222222222'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:15+00'::timestamp with time zone, '00003a98-0000-4000-8000-000000003a98'::uuid))) Buffers: shared hit=7 Planning Time: 0.048 ms Execution Time: 0.053 ms (7 rows)