\d+
명령에서 부분 색인을 볼 수있는 이유는 무엇입니까? Seq scan
가 표시됩니다.일부 인덱싱이 적용되지 않습니다.
\d+ call_records;
id | integer | not null default nextval('call_records_id_seq'::regclass) | plain | |
plain_crn | bigint |
active | boolean | default true
timestamp | bigint | default 0
Indexes:
"index_call_records_on_plain_crn" UNIQUE, btree (plain_crn)
"index_call_records_on_active" btree (active) WHERE active = true
예상대로 id
에 대해 인덱스 스캔이있었습니다. 같은
EXPLAIN select * from call_records where id=1;
QUERY PLAN
----------------------------------------------------------------------------------------
Index Scan using call_records_pkey on call_records (cost=0.14..8.16 rows=1 width=373)
Index Cond: (id = 1)
(2 rows)
는 active
의 경우는 동일하지, plain_crn
EXPLAIN select * from call_records where plain_crn=1;
QUERY PLAN
------------------------------------------------------------------------------------------------------
Index Scan using index_call_records_on_plain_crn on call_records (cost=0.14..8.16 rows=1 width=373)
Index Cond: (plain_crn = 1)
(2 rows)
간다하지만. 당신은 인덱스의 비용이
SET enable_seqscan = OFF;
당신은 그것을 볼 스캔 테스트를 시작해야
EXPLAIN select * from call_records where active=true; QUERY PLAN
-----------------------------------------------------------------
Seq Scan on call_records (cost=0.00..12.00 rows=100 width=373)
Filter: active
(2 rows)
'(분석, 상세)'설명 모든 쿼리에 대한 –