indexes on primary and foreign keys

From: Burak Seydioglu <buraks78(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: indexes on primary and foreign keys
Date: 2006-01-11 22:38:42
Message-ID: 1b8a973c0601111438m3e0b1cc0hf9c387a4a1d6791d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-01-11 23:03:05 Re: Extremely irregular query performance
Previous Message Jean-Philippe Côté 2006-01-11 22:37:24 Extremely irregular query performance