【发布时间】:2014-02-06 21:35:19
【问题描述】:
我有一个表,其中包含一个名为 account_id 的整数列。我在该列上有一个索引。
但似乎 Postgres 不想使用我的索引:
EXPLAIN ANALYZE SELECT "invoices".* FROM "invoices" WHERE "invoices"."account_id" = 1;
Seq Scan on invoices (cost=0.00..6504.61 rows=117654 width=186) (actual time=0.021..33.943 rows=118027 loops=1)
Filter: (account_id = 1)
Rows Removed by Filter: 51462
Total runtime: 39.917 ms
(4 rows)
知道为什么会这样吗?
【问题讨论】:
标签: sql database postgresql indexing