Foreign keys question (performance)

Поиск
Список
Период
Сортировка
От Phoenix Kiula
Тема Foreign keys question (performance)
Дата
Msg-id CAFWfU=uX41s5_zipaDyy8Zxxo6Wz--Ygsjn9=-aVGKyy+4_Wxg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Foreign keys question (performance)
Список pgsql-general
Hi.

I have a foreign key as such:


ALTER TABLE child_table
ADD CONSTRAINT fk_child
FOREIGN KEY (stringid) REFERENCES parent_table (stringid) MATCH FULL
ON DELETE CASCADE ;


Questions:

1. Is "MATCH FULL" adding any value here? If the foreign key is just
on an "id" column, what purpose does it serve? Without it, the results
would be the same? Does it affect performance or should I leave it be?
(Note that the id is a alphanumeric value)

2. More importantly, in this case basically the child_table cannot
have any keys that the parent_table doesn't have either. Will INSERTs
and UPDATEs to the parent_table be slower? Or will the foreign key
check happen only when INSERT or UPDATE happen to the child_table?


Thanks!

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

Предыдущее
От: Christoph Zwerschke
Дата:
Сообщение: Re: Shared memory usage in PostgreSQL 9.1
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Foreign keys question (performance)