24 lines
3.9 KiB
Plaintext
24 lines
3.9 KiB
Plaintext
docker compose --env-file .env exec db psql -U messenger -d messenger -c "EXPLAIN (ANALYZE, BUFFERS) SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at FROM messages m WHERE m.chat_id = '$SMALL' AND (m.created_at, m.id) > ('2026-09-15 00:00:00+00', '00000000-0000-0000-0000-000000000000') ORDER BY m.created_at ASC, m.id ASC LIMIT 50;" 2>&1 | Tee-Object "$EV5\10-explain-small-tuple.txt"
|
|
|
|
QUERY PLAN
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Limit (cost=159.50..159.60 rows=43 width=110) (actual time=0.129..0.133 rows=44 loops=1)
|
|
Buffers: shared hit=24
|
|
-> Sort (cost=159.50..159.60 rows=43 width=110) (actual time=0.128..0.130 rows=44 loops=1)
|
|
Sort Key: created_at, id
|
|
Sort Method: quicksort Memory: 30kB
|
|
Buffers: shared hit=24
|
|
-> Bitmap Heap Scan on messages m (cost=4.86..158.33 rows=43 width=110) (actual time=0.040..0.083 rows=44 loops=1)
|
|
Recheck Cond: ((chat_id = '4356b313-32de-48a1-9a8f-72e84685c264'::uuid) AND (ROW(created_at, id) > ROW('2026-09-15 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))
|
|
Heap Blocks: exact=15
|
|
Buffers: shared hit=18
|
|
-> Bitmap Index Scan on idx_messages_chat_created_asc_id (cost=0.00..4.85 rows=43 width=0) (actual time=0.028..0.028 rows=44 loops=1)
|
|
Index Cond: ((chat_id = '4356b313-32de-48a1-9a8f-72e84685c264'::uuid) AND (ROW(created_at, id) > ROW('2026-09-15 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))
|
|
Buffers: shared hit=3
|
|
Planning:
|
|
Buffers: shared hit=136
|
|
Planning Time: 0.927 ms
|
|
Execution Time: 0.239 ms
|
|
(17 rows)
|
|
|