From: K C Lau <kclau60@netvigator.com>
To: pgsql-performance@postgresql.org
Subject: Re: indexes on primary and foreign keys
Date: Thu, 12 Jan 2006 08:36:19 +0800
Message-ID: <6.2.1.2.0.20060112083033.02bb74c8@localhost> (raw)
In-Reply-To: <20060111232157.GA88829@winnie.fuhr.org>
References: <1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com>
<20060111232157.GA88829@winnie.fuhr.org>
At 07:21 06/01/12, Michael Fuhr wrote:
>On Wed, Jan 11, 2006 at 02:38:42PM -0800, Burak Seydioglu wrote:
> > I do a load of sql joins using primary and foreign keys. What i would like
> > to know if PostgreSQL creates indexes on these columns automatically (in
> > addition to using them to maintain referential integrity) or do I have to
> > create an index manually on these columns as indicated below?
> >
> > CREATE TABLE cities (
> > city_id integer primary key,
> > city_name varchar(50)
> > );
> >
> > CREATE INDEX city_id_index ON cities(city_id);
>
>PostgreSQL automatically creates indexes on primary keys. If you run
>the above CREATE TABLE statement in psql you should see a message to
>that effect:
>
>NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
>"cities_pkey" for table "cities"
Is there a way to suppress this notice when I create tables in a script?
Best regards,
KC.
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-performance@postgresql.org
Cc: kclau60@netvigator.com
Subject: Re: indexes on primary and foreign keys
In-Reply-To: <6.2.1.2.0.20060112083033.02bb74c8@localhost>
* 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