pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Seb <spluque@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: indexes
Date: Sun, 17 Jan 2010 19:10:08 -0600
Message-ID: <87fx64jk0f.fsf@kolob.sebmags.homelinux.org> (raw)
References: <87iqb3z74n.fsf@kolob.sebmags.homelinux.org>
	<4B53885C.3060706@gmail.com>

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




view thread (22+ messages)  latest in thread

Message-ID: <87fx64jk0f.fsf@kolob.sebmags.homelinux.org>
Permalink:  ../87fx64jk0f.fsf@kolob.sebmags.homelinux.org/
Also on:    postgresql.org/message-id/87fx64jk0f.fsf@kolob.sebmags.homelinux.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spluque@gmail.com
  Subject: Re: indexes
  In-Reply-To: <87fx64jk0f.fsf@kolob.sebmags.homelinux.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox