Foreign keys question (performance) - Mailing list pgsql-general

From Phoenix Kiula
Subject Foreign keys question (performance)
Date
Msg-id CAFWfU=uX41s5_zipaDyy8Zxxo6Wz--Ygsjn9=-aVGKyy+4_Wxg@mail.gmail.com
Whole thread Raw
Responses Re: Foreign keys question (performance)  (Alban Hertroys <haramrae@gmail.com>)
List 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 by date:

Previous
From: Christoph Zwerschke
Date:
Subject: Re: Shared memory usage in PostgreSQL 9.1
Next
From: Alban Hertroys
Date:
Subject: Re: Foreign keys question (performance)