Can PostgreSQL use multi-column index for FK constraint validation?

From: Dane Foster <studdugie(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Can PostgreSQL use multi-column index for FK constraint validation?
Date: 2016-01-26 19:38:30
Message-ID: CA+Wxin+5WNUWPuDaN8USakSgVFH4Ryp8YbcPmb=XCppFXNaWeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

If I have a primary key index of the form:
(col1, col2, col3)
and a foreign key constraint of the form:
FOREIGN KEY (col1, col2) REFERENCES foo
ON DELETE CASCADE ON UPDATE CASCADE
should I create a separate index (col1, col2) or is PostgreSQL capable of
using the primary key's index?

Thanks,

Dane

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2016-01-26 19:44:37 Re: Can PostgreSQL use multi-column index for FK constraint validation?
Previous Message Joshua D. Drake 2016-01-26 19:01:01 Re: CoC [Final v2]