forked from mtusi2026/mtusi2026lab2
30 lines
1.9 KiB
Plaintext
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..4.29 rows=51 width=70) (actual time=0.010..0.023 rows=51 loops=1)
|
|
Buffers: shared hit=4
|
|
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..786.29 rows=10000 width=70) (actual time=0.010..0.019 rows=51 loops=1)
|
|
Index Cond: (chat_id = 'e430ecd3-d167-42cf-923e-9d8864aa454a'::uuid)
|
|
Buffers: shared hit=4
|
|
Planning Time: 0.057 ms
|
|
Execution Time: 0.032 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..5.65 rows=51 width=70) (actual time=0.013..0.022 rows=51 loops=1)
|
|
Buffers: shared hit=4
|
|
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..520.50 rows=4945 width=70) (actual time=0.012..0.019 rows=51 loops=1)
|
|
Index Cond: ((chat_id = 'e430ecd3-d167-42cf-923e-9d8864aa454a'::uuid) AND (ROW(created_at, id) > ROW('2026-10-30 21:47:47.309662+00'::timestamp with time zone, '09540584-a18b-4d60-8a4d-6090097999ba'::uuid)))
|
|
Buffers: shared hit=4
|
|
Planning Time: 0.055 ms
|
|
Execution Time: 0.033 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..70.42 rows=51 width=70) (actual time=0.017..0.027 rows=51 loops=1)
|
|
Buffers: shared hit=3
|
|
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.29..135.06 rows=98 width=70) (actual time=0.017..0.023 rows=51 loops=1)
|
|
Index Cond: ((chat_id = 'e430ecd3-d167-42cf-923e-9d8864aa454a'::uuid) AND (ROW(created_at, id) > ROW('2026-10-30 21:47:47.314562+00'::timestamp with time zone, '6a60bce1-7a0f-45d3-9836-95b9d7797e39'::uuid)))
|
|
Buffers: shared hit=3
|
|
Planning Time: 0.072 ms
|
|
Execution Time: 0.041 ms
|