18 lines
3.0 KiB
Plaintext
18 lines
3.0 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 = '$MEDIUM' AND (m.created_at > '2026-09-15 00:00:00+00' OR (m.created_at = '2026-09-15 00:00:00+00' AND m.id > '00000000-0000-0000-0000-000000000000')) ORDER BY m.created_at ASC, m.id ASC LIMIT 50;" 2>&1 | Tee-Object "$EV5\06-explain-medium-or.txt"
|
|
|
|
QUERY PLAN
|
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
Limit (cost=0.42..185.97 rows=50 width=110) (actual time=1.793..1.835 rows=50 loops=1)
|
|
Buffers: shared hit=3048
|
|
-> Index Scan using idx_messages_chat_created_asc_id on messages m (cost=0.42..8016.49 rows=2160 width=110) (actual time=1.791..1.828 rows=50 loops=1)
|
|
Index Cond: (chat_id = '237c29c6-9d07-4f3b-b9f0-69b3428f1168'::uuid)
|
|
Filter: ((created_at > '2026-09-15 00:00:00+00'::timestamp with time zone) OR ((created_at = '2026-09-15 00:00:00+00'::timestamp with time zone) AND (id > '00000000-0000-0000-0000-000000000000'::uuid)))
|
|
Rows Removed by Filter: 3001
|
|
Buffers: shared hit=3048
|
|
Planning:
|
|
Buffers: shared hit=147
|
|
Planning Time: 1.383 ms
|
|
Execution Time: 1.914 ms
|
|
(11 rows)
|
|
|