因为:
Seq Scan on invoices (...) (actual ... rows=118027 <鈥? this
Filter: (account_id = 1)
Rows Removed by Filter: 51462 <鈥? vs this
Total runtime: 39.917 ms
您选择的行太多了,以至于读取整个表都比较便宜。
为什么Postgres不使用索引?
因为:
Seq Scan on invoices (...) (actual ... rows=118027 <鈥? this
Filter: (account_id = 1)
Rows Removed by Filter: 51462 <鈥? vs this
Total runtime: 39.917 ms
您选择的行太多了,以至于读取整个表都比较便宜。