From: Tom Lane <tgl@sss.pgh.pa.us>
To: mailreg@numerixtechnology.de
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Join Table
Date: Mon, 01 Nov 2004 12:07:38 -0500
Message-ID: <14976.1099328858@sss.pgh.pa.us> (raw)
In-Reply-To: <41866598.5040909@numerixtechnology.de>
References: <41866598.5040909@numerixtechnology.de>
T E Schmitz <mailreg@numerixtechnology.de> writes:
> CREATE TABLE SUPPLY
> (
> ITEM_FK integer NOT NULL,
> CONTACT_FK integer NOT NULL,
> COST numeric (7,2),
> PRIMARY KEY (ITEM_FK,CONTACT_FK)
> );
> Question: is it necessary/advisable to create an index for the ITEM_FK
> column? Or is this redundantbecause this column is already one of the PK
> columns?
The PK index will be usable for searches on ITEM_FK alone (though *not*
for searches on CONTACT_FK alone --- a moment's thought about the index
sort order should convince you why). It would be marginally less
efficient for this purpose than a dedicated index on ITEM_FK. But unless
your use of this table is almost all searches and hardly any
modifications, adding a dedicated index is probably a net loss due to
the added update costs.
regards, tom lane
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: tgl@sss.pgh.pa.us, mailreg@numerixtechnology.de
Subject: Re: Join Table
In-Reply-To: <14976.1099328858@sss.pgh.pa.us>
* 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