Files
mtusi2026lab3/evidence/clean-explain.txt
T

30 lines
1.9 KiB
Plaintext

FIRST
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..6.27 rows=51 width=72) (actual time=0.021..0.031 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..1173.00 rows=10000 width=72) (actual time=0.020..0.027 rows=51 loops=1)
Index Cond: (chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid)
Buffers: shared hit=5
Planning Time: 0.106 ms
Execution Time: 0.049 ms
MIDDLE
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s AND (created_at, id) > (%s, %s) ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..8.78 rows=51 width=72) (actual time=0.020..0.028 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..796.60 rows=4782 width=72) (actual time=0.019..0.024 rows=51 loops=1)
Index Cond: ((chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 14:17:09.314636+00'::timestamp with time zone, '179a43c3-4807-4a81-9699-e48b56f1a4de'::uuid)))
Buffers: shared hit=3
Planning Time: 0.100 ms
Execution Time: 0.044 ms
LATE
SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id=%s AND (created_at, id) > (%s, %s) ORDER BY created_at, id LIMIT %s
Limit (cost=0.29..113.51 rows=51 width=72) (actual time=0.023..0.037 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..211.19 rows=95 width=72) (actual time=0.021..0.032 rows=51 loops=1)
Index Cond: ((chat_id = '1b152a21-d5f0-4fae-884d-713967665562'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 14:17:09.319536+00'::timestamp with time zone, '5e558383-5ef2-4321-805a-a4484cfd2f27'::uuid)))
Buffers: shared hit=5
Planning Time: 0.099 ms
Execution Time: 0.053 ms