pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Marc Mitchell <marcm@eisolution.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: PRIMARY KEY Indexes.
Date: Mon, 28 Jan 2002 08:59:53 -0800 (PST)
Message-ID: <20020128085350.V75869-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <00d001c1a81a$d2fb86c0$7501050a@marcmdelltop>

On Mon, 28 Jan 2002, Marc Mitchell wrote:

> pgsqlPostgres automatically creates a unique index to assure data integrity
> (see CREATE INDEX statement).
>
> The online docs at
> http://www.postgresql.org/idocs/index.php?sql-createtable.html state the
> following:
>
> " Postgres automatically creates a unique index to assure data integrity
> (see CREATE INDEX statement). "  ... when PRIMARY KEY is specified within a
> CREATE TABLE statement.
>
> My questions:
>
> 1) Are these indexes at all visible to a tool like PGAdmin?  How are they
> named?

The name is <table>_pkey.  I'd assume they are visible assuming PGAdmin
doesn't hide them and just show the primary key constraint.

> 2) If FORIGN KEY constraints were present on tables, I assume a lookup is
> done at time of INSERT to ensure the referenced value can be found.  Would
> such a lookup and the index used be seen in the EXPLAIN or EXPLAIN VERBOSE
> output of an INSERT?

It should generally use the index.  There are cases due to the saved plan
where the best plan might change during a session and we won't notice that
until the next session.  The explain output won't show the fk lookups as
far as I know, however.





view thread (2+ messages)

Message-ID: <20020128085350.V75869-100000@megazone23.bigpanda.com>
Permalink:  ../20020128085350.V75869-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020128085350.V75869-100000@megazone23.bigpanda.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, marcm@eisolution.com
  Subject: Re: PRIMARY KEY Indexes.
  In-Reply-To: <20020128085350.V75869-100000@megazone23.bigpanda.com>
  References: <00d001c1a81a$d2fb86c0$7501050a@marcmdelltop> <20020128085350.V75869-100000@megazone23.bigpanda.com>

* 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