Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Dane Foster
Sent: Tuesday, January 26, 2016 2:39 PM
To: pgsql-general <pgsql-general@xxxxxxxxxxxxxx>
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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux