Re: indexes - Mailing list pgsql-sql

From Seb
Subject Re: indexes
Date
Msg-id 87fx64jk0f.fsf@kolob.sebmags.homelinux.org
Whole thread Raw
In response to indexes  (Seb <spluque@gmail.com>)
Responses Re: indexes  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-sql
On Mon, 18 Jan 2010 08:59:56 +1100,
Chris <dmagick@gmail.com> 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 may need it
> to say "aha - this was last changed on this date and by person X", but
> you'll never generally use it.

> If you never have a where clause with that column, no need to index
> it. If you're using it in a join all the time, then yes it would be
> better to index it.

Thanks for all your pointers!

Do views use the indexes in the underlying tables, whenever say a SELECT
operation is called on the view?  If so, indexes on views don't make any
sense right?


-- 
Seb



pgsql-sql by date:

Previous
From: Chris
Date:
Subject: Re: indexes
Next
From: Craig Ringer
Date:
Subject: Re: indexes