From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
---|---|
To: | Dane Foster <studdugie(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can PostgreSQL use multi-column index for FK constraint validation? |
Date: | 2016-01-26 19:44:37 |
Message-ID: | A76B25F2823E954C9E45E32FA49D70ECCD5E1B63@mail.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Dane Foster
Sent: Tuesday, January 26, 2016 2:39 PM
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: [GENERAL] Can PostgreSQL use multi-column index for FK constraint validation?
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
Columns in proposed index on FK (col1, col2) are in the same order (and in the beginning) of PK index.
So, no need for additional index (col1, col2).
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2016-01-26 20:10:24 | Re: request for comment re "contributor-covenant.org" |
Previous Message | Dane Foster | 2016-01-26 19:38:30 | Can PostgreSQL use multi-column index for FK constraint validation? |