Files
mtusi2026lab3/evidence/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..5.85 rows=51 width=71) (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..1091.76 rows=10000 width=71) (actual time=0.019..0.024 rows=51 loops=1)
Index Cond: (chat_id = '77be5bc0-11e0-4330-a660-198fe31253f8'::uuid)
Buffers: shared hit=3
Planning Time: 0.093 ms
Execution Time: 0.040 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..7.76 rows=51 width=71) (actual time=0.029..0.046 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..707.54 rows=4827 width=71) (actual time=0.028..0.038 rows=51 loops=1)
Index Cond: ((chat_id = '77be5bc0-11e0-4330-a660-198fe31253f8'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 13:55:23.37413+00'::timestamp with time zone, '8527233a-bd37-41c0-92ab-a83710dbaf42'::uuid)))
Buffers: shared hit=3
Planning Time: 0.116 ms
Execution Time: 0.067 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..87.97 rows=51 width=71) (actual time=0.014..0.023 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..165.33 rows=96 width=71) (actual time=0.013..0.019 rows=51 loops=1)
Index Cond: ((chat_id = '77be5bc0-11e0-4330-a660-198fe31253f8'::uuid) AND (ROW(created_at, id) > ROW('2026-11-01 13:55:23.37903+00'::timestamp with time zone, '2cb28284-13ea-47b3-9eda-45aeb4bda794'::uuid)))
Buffers: shared hit=4
Planning Time: 0.079 ms
Execution Time: 0.035 ms