constraint performance - Mailing list pgsql-general

From Joseph Shraibman
Subject constraint performance
Date
Msg-id 3E9335F1.6010602@selectacast.net
Whole thread Raw
Responses Re: constraint performance  (Richard Huxton <dev@archonet.com>)
List pgsql-general
create table taba( id int PRIMARY KEY, name text);
create table tabb( rid int PRIMARY KEY REFERENCES taba(id));

insert into taba values (1,'1');
insert into taba values (2,'2');

insert into tabb values(1);

explain delete from taba where id = 1;
explain delete from taba where id = 2;

The explain doesn't show any checking of the constraint, but the checking is done
somewhere.  How much does the checking cost?  If I delete any value from taba does it
check tabb to see if that row is refrenced, is something marked in the taba row to
indicate it is refrenced?  If I update taba does it check only if I update id, or will it
check no matter what field I update?


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Is the += or *= operator used in PostgreSQL ?
Next
From: "scott.marlowe"
Date:
Subject: Re: Cross database reference (databases are on the same