11 lines
1.9 KiB
Plaintext
11 lines
1.9 KiB
Plaintext
=== EXPLAIN (ANALYZE, BUFFERS) ===
|
||
1. С ИНДЕКСОМ:
|
||
QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.42..174.90 rows=50 width=72) (actual time=0.037..0.045 rows=50 loops=1) Buffers: shared hit=5 -> Index Scan using idx_messages_chat_created on messages (cost=0.42..1507.98 rows=432 width=72) (actual time=0.035..0.042 rows=50 loops=1) Index Cond: (chat_id = '00000000-0000-0000-0000-000000000002'::uuid) Buffers: shared hit=5 Planning: Buffers: shared hit=103 Planning Time: 1.105 ms Execution Time: 0.093 ms (9 rows)
|
||
|
||
2. БЕЗ ИНДЕКСА (DROP INDEX):
|
||
DROP INDEX
|
||
QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- Limit (cost=2329.98..2330.10 rows=50 width=72) (actual time=29.699..29.705 rows=50 loops=1) Buffers: shared hit=1241 -> Sort (cost=2329.98..2331.06 rows=432 width=72) (actual time=29.698..29.700 rows=50 loops=1) Sort Key: created_at, id Sort Method: top-N heapsort Memory: 38kB Buffers: shared hit=1241 -> Seq Scan on messages (cost=0.00..2315.62 rows=432 width=72) (actual time=0.008..11.990 rows=100000 loops=1) Filter: (chat_id = '00000000-0000-0000-0000-000000000002'::uuid) Rows Removed by Filter: 2 Buffers: shared hit=1235 Planning: Buffers: shared hit=81 dirtied=1 Planning Time: 0.385 ms Execution Time: 29.751 ms (14 rows)
|
||
|
||
3. ВОЗВРАЩАЕМ ИНДЕКС:
|
||
CREATE INDEX
|