26 lines
2.8 KiB
Plaintext
26 lines
2.8 KiB
Plaintext
docker compose --env-file .env exec db psql -U messenger -d messenger -c "BEGIN; DROP INDEX idx_messages_chat_created_asc_id; EXPLAIN (ANALYZE, BUFFERS) SELECT m.id, m.chat_id, m.sender_id, m.text, m.created_at FROM messages m WHERE m.chat_id = '22222222-2222-4222-8222-222222222222' ORDER BY m.created_at ASC, m.id ASC LIMIT 50; ROLLBACK;" 2>&1 | Tee-Object "$EV4\14-explain-no-index.txt"
|
|
|
|
|
|
|
|
BEGIN
|
|
DROP INDEX
|
|
QUERY PLAN
|
|
----------------------------------------------------------------------------------------------------------------------------
|
|
Limit (cost=704.33..704.46 rows=50 width=168) (actual time=2.398..2.404 rows=50 loops=1)
|
|
Buffers: shared hit=253
|
|
-> Sort (cost=704.33..729.33 rows=10000 width=168) (actual time=2.397..2.400 rows=50 loops=1)
|
|
Sort Key: created_at, id
|
|
Sort Method: top-N heapsort Memory: 47kB
|
|
Buffers: shared hit=253
|
|
-> Seq Scan on messages m (cost=0.00..372.14 rows=10000 width=168) (actual time=0.010..1.551 rows=10000 loops=1)
|
|
Filter: (chat_id = '22222222-2222-4222-8222-222222222222'::uuid)
|
|
Rows Removed by Filter: 11
|
|
Buffers: shared hit=247
|
|
Planning:
|
|
Buffers: shared hit=79
|
|
Planning Time: 0.453 ms
|
|
Execution Time: 2.456 ms
|
|
(14 rows)
|
|
|
|
ROLLBACK
|