pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Burak Seydioglu <buraks78@gmail.com>
To: pgsql-performance@postgresql.org
Subject: indexes on primary and foreign keys
Date: Wed, 11 Jan 2006 14:38:42 -0800
Message-ID: <1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com> (raw)

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);

Thanks for any insight.

Burak

view thread (9+ messages)  latest in thread

Message-ID: <1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com>
Permalink:  ../1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com/
Also on:    postgresql.org/message-id/1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.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-performance@postgresql.org
  Cc: buraks78@gmail.com
  Subject: Re: indexes on primary and foreign keys
  In-Reply-To: <1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com>
  References: <1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.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