constraint performance

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: constraint performance
Date: 2003-04-08 20:49:53
Message-ID: 3E9335F1.6010602@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-04-08 20:58:57 Re: Cross database reference (databases are on the same
Previous Message Stephan Szabo 2003-04-08 20:44:12 Re: Is the += or *= operator used in PostgreSQL ?