From: | Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> |
---|---|
To: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Foreign keys question (performance) |
Date: | 2011-12-04 10:19:27 |
Message-ID: | CAFWfU=uX41s5_zipaDyy8Zxxo6Wz--Ygsjn9=-aVGKyy+4_Wxg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2011-12-04 11:14:34 | Re: Foreign keys question (performance) |
Previous Message | Christoph Zwerschke | 2011-12-03 21:33:36 | Re: Shared memory usage in PostgreSQL 9.1 |