我有两个表:PostgreSQL 8.3版本,简单的查询不使用索引
table1 (about 200000 records)
number varchar(8)
table2 (about 2000000 records)
number varchar(8)
场两个表中的“号”有标准的指标。 对于table1中的每条记录,table2中大约有10条记录被分配。
我执行查询:
explain select table1.number from table1, table2 where table1.number = table2.number;
查询计划显示索引不会,序列扫描各地使用;)
但是,如果我减少表1至〜2000查询计划的记录量开始显示索引将被使用。
也许有人可以告诉我为什么postgresql的行为是这样的?
由于过去的设计决定,它并不总是一个数字 – 2009-12-03 14:34:15