pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
PRIMARY KEY Indexes. 2+ messages / 2 participants [nested] [flat]
* PRIMARY KEY Indexes. @ 2002-01-28 16:42 Marc Mitchell <marcm@eisolution.com> 2002-01-28 16:59 ` Re: PRIMARY KEY Indexes. Stephan Szabo <sszabo@megazone23.bigpanda.com> 0 siblings, 1 reply; 2+ messages in thread From: Marc Mitchell @ 2002-01-28 16:42 UTC (permalink / raw) To: pgsql-admin 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? 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? For the record: OS is RedHat Linux 2.2.19 #8 SMP Fri Sep 21 10:04:24 CDT Postgres is PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC 2.96 -admin@postgresql.org <pgsql-admin@postgresql.org> ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PRIMARY KEY Indexes. 2002-01-28 16:42 PRIMARY KEY Indexes. Marc Mitchell <marcm@eisolution.com> @ 2002-01-28 16:59 ` Stephan Szabo <sszabo@megazone23.bigpanda.com> 0 siblings, 0 replies; 2+ messages in thread From: Stephan Szabo @ 2002-01-28 16:59 UTC (permalink / raw) To: Marc Mitchell <marcm@eisolution.com>; +Cc: pgsql-admin 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. ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-01-28 16:59 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2002-01-28 16:42 PRIMARY KEY Indexes. Marc Mitchell <marcm@eisolution.com> 2002-01-28 16:59 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
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