Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ2s2-0002hE-9Q for pgsql-general@arkaria.postgresql.org; Mon, 25 Nov 2019 01:08:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iZ2s0-0006sG-Sz for pgsql-general@arkaria.postgresql.org; Mon, 25 Nov 2019 01:08:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ2s0-0006s9-JH for pgsql-general@lists.postgresql.org; Mon, 25 Nov 2019 01:08:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ2ry-0004Bf-3A for pgsql-general@lists.postgresql.org; Mon, 25 Nov 2019 01:08:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xAP18jPu017713; Sun, 24 Nov 2019 20:08:45 -0500 From: Tom Lane To: Jeff Janes cc: Blake McBride , pgsql-general Subject: Re: Trouble incrementing a column In-reply-to: References: <17273.1574545645@sss.pgh.pa.us> Comments: In-reply-to Jeff Janes message dated "Sun, 24 Nov 2019 19:51:11 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17711.1574644125.1@sss.pgh.pa.us> Date: Sun, 24 Nov 2019 20:08:45 -0500 Message-ID: <17712.1574644125@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeff Janes writes: > On Sat, Nov 23, 2019 at 4:47 PM Tom Lane wrote: >> Note that you pay a fairly substantial performance penalty for deferring >> the check, which is why it isn't the default, even though the SQL spec >> says it ought to be. > Do you know what the worst case scenario is for the performance of > deferring the check to the end of the statement (with deferred initially > immediate)? Upon testing, I get a penalty of 2 to 5%, which seems pretty > small, but I might not be testing the most adverse situation. See attached. Hm, I would have expected more, though not factor-of-10 or anything like that. But that's just vague recollection from when we put in the feature. I'm not surprised if the numbers have moved since. > The main "cost" that prevents from using DII routinely is that they can't > receive foreign key constraints. Yeah, that's an issue. regards, tom lane