Re: [GENERAL] 1- and 2-dimensional indexes on same column: why is the 2d one preferred?

2009-03-24 Thread Marinos Yannikos
Tom Lane schrieb: Marinos Yannikos m...@geizhals.at writes: i_a btree (a) i_ab btree (a, b) I suspect that these indexes are exactly the same size --- look at pg_class.relpages or use the pg_relation_size() function to verify. For some reason, the first one is actually about twice the size

[GENERAL] 1- and 2-dimensional indexes on same column: why is the 2d one preferred?

2009-03-23 Thread Marinos Yannikos
Recent versions of PostgreSQL seem to prefer 2d indexes somehow: for a table foo with i_a btree (a) i_ab btree (a, b) SELECT * FROM foo WHERE a=123 will often use i_ab and not i_a (even right after ANALYZE). This raises some questions: - is there even any benefit in still having both these

Re: [GENERAL] 1- and 2-dimensional indexes on same column: why is the 2d one preferred?

2009-03-23 Thread Tom Lane
Marinos Yannikos m...@geizhals.at writes: Recent versions of PostgreSQL seem to prefer 2d indexes somehow: for a table foo with i_a btree (a) i_ab btree (a, b) SELECT * FROM foo WHERE a=123 will often use i_ab and not i_a (even right after ANALYZE). I suspect that these indexes are exactly