Re: [GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Matthew Walden
"Apparently (after reading the documentation link provided by Tom) there can be value to indexes when accessed with leading columns missing". That is a new one on me too - interesting. I suppose it comes down to testing at the end of the day - if you "set enable_seqscan to false" and "EXPLAIN ANA

Re: [GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Dann Corbit
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Dann Corbit Sent: Monday, November 15, 2010 12:21 PM To: 'Dan Halbert'; pgsql-general@postgresql.org Subject: Re: [GENERAL] Indexes on individual columns of composite primary key From: pgs

Re: [GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Dann Corbit
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Dan Halbert Sent: Monday, November 15, 2010 12:01 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Indexes on individual columns of composite primary key I have a table with four columns

Re: [GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Matthew Walden
Dan, It depends on your application. There is no point in creating an index with the same 3 columns in the primary key (in the same order). If you have an index on COL1, COL2 and COL3 (in that order) then if you have a query such as SELECT COL1, COL2, COL3 from T1 then the index will be consider

Re: [GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Tom Lane
"Dan Halbert" writes: > I have a table with four columns. Three of those columns are defined > as the composite primary key. Does it make sense to create indexes on > any or all of those three columns individually for performance > reasons? Please see http://www.postgresql.org/docs/9.0/static/ind

[GENERAL] Indexes on individual columns of composite primary key

2010-11-15 Thread Dan Halbert
I have a table with four columns. Three of those columns are defined as the composite primary key. Does it make sense to create indexes on any or all of those three columns individually for performance reasons? PG does let me create the indexes. But perhaps it's redundant, since there's an impl