Re: ON UPDATE CASCADE overhead?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Forest Wilkinson <fspam(at)home(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: ON UPDATE CASCADE overhead?
Date: 2001-05-18 13:37:00
Message-ID: 200105181337.JAA01649@jupiter.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Forest Wilkinson wrote:
> If I add ON UPDATE CASCADE to my foreign key definitions, how much will it
> affect performance for queries that don't trigger the cascade?

The trigger fired on the PK table does a check if the key
fields changed first. Therefore, at the first time of fireing
for this action during backend lifetime it'll do some
syscache lookups and remember the comparision functions to
call for this check. From then on it'll call the comparision
functions directly and return immediately without doing any
real work if the key effectively didn't change.

I expect it to not affect the performance significant. Would
be nice though if you'd run some tests and share the results
with us.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2001-05-18 13:39:15 Calculating the age of a person
Previous Message Martín Marqués 2001-05-18 13:26:07 Re: search for groups with a user