Search Postgresql Archives

Re: Creating indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Fitzpatrick wrote:
Now my question, would it be better to create one index with all columns
in the table -or- a separate index for each column field? I was assuming
the latter, but would the index with all columns be beneficial as well?


Generally it's much better to have an index deal with only one column. Also I wouldn't just randomly throw an index on every column. You should only index the columns that used for the constraints. You might benefit from turning up the logging and looking at what queries are slow, then play with them and viewing their explain output with / without indexes.

Extra indexes that aren't really doing anything can actually hurt performance during vacuum or insert / update / delete.

Matt


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux