Re: [GENERAL] optimizer choosing the wrong index

2010-07-08 Thread Martin Below
Hello Merlin, thanks for your help. > can you supply the plans on the actual tables?  the 'wrong' index > might actually be the 'right' one if expires_on is of high cardinality > (perhaps it's distributed badly and the table needs a stats tweak to > make it correct). test=# select count(*) total

[GENERAL] optimizer choosing the wrong index

2010-07-07 Thread Martin Below
hout time zone))  Total runtime: 0.058 ms The problem seems to me that the estimates costs are not correct. With the table containing about 200.000 records, using the "wrong" index takes about 22 times as long as using the "right" index. I did run "vacuum analyze", wit