Received: from smtp016.mail.yahoo.com (smtp016.mail.yahoo.com [216.136.174.113]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4IDYeA63670 for ; Fri, 18 May 2001 09:34:41 -0400 (EDT) (envelope-from janwieck@yahoo.com) Received: from jupiter.us.greatbridge.com (HELO jupiter.jw.home) (65.196.69.55) by smtp.mail.vip.sc5.yahoo.com with SMTP; 18 May 2001 13:34:35 -0000 X-Apparently-From: Received: (from janwieck@localhost) by jupiter.jw.home (8.9.3/8.9.3) id JAA01649; Fri, 18 May 2001 09:37:00 -0400 From: Jan Wieck Message-Id: <200105181337.JAA01649@jupiter.jw.home> Subject: Re: ON UPDATE CASCADE overhead? In-Reply-To: <01051717195200.04161@bartok> from Forest Wilkinson at "May 17, 2001 05:19:52 pm" To: Forest Wilkinson Date: Fri, 18 May 2001 09:37:00 -0400 (EDT) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/195 X-Sequence-Number: 3012 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@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com