FK index q'n

From: rihad <rihad(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: FK index q'n
Date: 2007-11-30 13:21:42
Message-ID: 47500E66.90601@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Given this table:

CREATE TABLE foo (
id integer primary key,
bar_id integer references bar (id)
);
and provided that bar.id is itself a PK, do I still need to create an
index on bar_id if often doing queries like:
SELECT MIN(id) FROM foo WHERE bar_id IS NULL;

Table foo will contain a static number of rows (from 2,000 to 10,000 --
yet undecided) only doing SELECT & UPDATE.

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2007-11-30 13:22:31 Re: PostgresSQL vs Ingress
Previous Message Josh Harrison 2007-11-30 13:21:18 Re: Recheck condition