Re: [SQL] indexes

2010-01-17 Thread Chris
Seb wrote: Hi, I have some views and queries that take a bit too long to return, so perhaps some judicious indexes might help, but I don't know much about how to use them. The PostgreSQL manual has a good section on indexes, but I can't find guidance on (unless I missed something): o How to de

Re: [SQL] indexes

2010-01-17 Thread Seb
On Mon, 18 Jan 2010 08:59:56 +1100, Chris wrote: >> o Should all foreign keys have an index? > Not necessarily, you might just want the db to enforce the restriction > but not actually use the data in it. For example, keep a userid (and > timestamp) column of the last person to update a row. You

Re: [SQL] indexes

2010-01-17 Thread Craig Ringer
Seb wrote: > On Mon, 18 Jan 2010 08:59:56 +1100, > Chris wrote: > >>> o Should all foreign keys have an index? > >> Not necessarily, you might just want the db to enforce the restriction >> but not actually use the data in it. For example, keep a userid (and >> timestamp) column of the last pers