【发布时间】:2017-07-21 13:02:59
【问题描述】:
我有我制作的表用户
CREATE INDEX user_status_index
ON public.users
USING btree
(status COLLATE pg_catalog."default", "keep_id" COLLATE pg_catalog."default");
当我这样做时
EXPLAIN ANALYZE select * from users where keep_id = 'pop90'
它给了我
"Seq Scan on users (cost=0.00..47284.38 rows=2 width=16) (actual time=960.463..3451.731 rows=2 loops=1)"
" Filter: (("keep_id")::text = 'pop90'::text)"
" Rows Removed by Filter: 1271935"
"Planning time: 0.075 ms"
"Execution time: 3451.773 ms"
为什么不进行索引扫描??
如何让它进行索引扫描??
任何帮助都会很明显
【问题讨论】:
标签: postgresql indexing postgresql-performance