[SQL] indexes

2010-01-15 Thread Seb
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 decide what columns need an index?
o Should all foreign keys have an index?
o Naming conventions?
o Does PostgreSQL use available indexes that can be useful in any query,
  without the user having to do anything in particular?

I'd appreciate any pointers to documents with guidance on these
questions.  Thanks.


-- 
Seb


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] rename primary key

2010-01-15 Thread Seb
On Fri, 15 Jan 2010 07:35:17 +0100,
Guillaume Lelarge  wrote:

[...]

> Primary keys are constraints. They are enforced with an index, but
> actually they are constraints. So we put them on the constraints
> nodes.

> There is the same behaviour for unique constraints.

Thanks.  Would there be any problem with listing the index used to
enforce the primary key constraint in the Indexes node to let us know of
its existence?  In fact, psql does report it with the meta-command \d.
It was somewhat confusing to see Indexes(0), and then having to rename
an index to rename a primary key constraint.


-- 
Seb


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql