Re: indexes

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: indexes
Date: 2010-01-18 01:10:08
Message-ID: 87fx64jk0f.fsf@kolob.sebmags.homelinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 18 Jan 2010 08:59:56 +1100,
Chris <dmagick(at)gmail(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Ringer 2010-01-18 01:22:07 Re: indexes
Previous Message Chris 2010-01-17 21:59:56 Re: indexes