Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

FK index q'n



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.



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group