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

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: Can PostgreSQL use multi-column index for FK constraint validation?
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70ECCD5E1B63@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Can PostgreSQL use multi-column index for FK constraint validation?  (Dane Foster <studdugie@gmail.com>)
Список pgsql-general

 

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

В списке pgsql-general по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Can PostgreSQL use multi-column index for FK constraint validation?
Следующее
От: leo
Дата:
Сообщение: Does pglogical support PG 9.4.5?