Will PG use composite index to enforce foreign keys?

From: John Burger <john(at)mitre(dot)org>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Will PG use composite index to enforce foreign keys?
Date: 2007-11-29 16:51:25
Message-ID: E38BF7A5-36E7-4DE8-A3A0-422F7DEA625B@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi -

I know that the foreign key machinery will use an index on the
referring column if one exists. My question is whether it will use a
composite index? For instance:

create table allLemmaSenseMap (
wordID integer references allLemmas,
senseID integer references allSenses,
primary key (wordID, senseID)
);

If I delete something from allLemmas, will the FK check use the PK
index above? (I know I should at least have an index on senseID as
well, because of the other foreign key.)

As a secondary question, is there any way I could have answered this
myself, using analyze, the system catalogs, etc? ANALYZE DELETE
doesn't seem to show the FK checking that must go on behind the scenes.

Thanks.

- John D. Burger
MITRE

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Usama Dar 2007-11-29 16:56:36 Re: 1 cluster on several servers
Previous Message Richard Huxton 2007-11-29 16:50:45 Re: HD is flooded by Error Log info