Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 44117B5DC4F for ; Mon, 31 Oct 2011 16:55:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 25727-02-5 for ; Mon, 31 Oct 2011 19:55:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id EC5A7B5DC52 for ; Mon, 31 Oct 2011 16:55:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p9VJtZnO007565; Mon, 31 Oct 2011 15:55:35 -0400 (EDT) To: Robert Haas cc: Greg Jaskiewicz , Anibal David Acosta , pgsql-performance@postgresql.org Subject: Re: does update of column with no relation imply a relation check of other column? In-reply-to: References: <00ce01cc8e76$ed533480$c7f99d80$@devshock.com> Comments: In-reply-to Robert Haas message dated "Mon, 31 Oct 2011 14:19:18 -0400" Date: Mon, 31 Oct 2011 15:55:35 -0400 Message-ID: <7564.1320090935@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.101 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.201 X-Spam-Level: X-Archive-Number: 201110/289 X-Sequence-Number: 45511 Robert Haas writes: > On Wed, Oct 19, 2011 at 12:42 PM, Greg Jaskiewicz wrote: >> When I do an insert on table B, the database check if value for column >> “table_a_id” exists in table A >> But, if I do an update of column “address” of table B, does the database >> check again? > I just tested this, and it seems not. It will not, unless you update the same row more than once in a single transaction. If you do that, it no longer has enough information to be sure the referencing value hasn't changed in that transaction, so it will do a check. regards, tom lane