Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZZ8R-0006VB-Q2 for pgsql-hackers@postgresql.org; Sat, 17 Nov 2012 03:31:59 +0000 Received: from mail-vc0-f174.google.com ([209.85.220.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TZZ8P-0006dH-6z for pgsql-hackers@postgresql.org; Sat, 17 Nov 2012 03:31:58 +0000 Received: by mail-vc0-f174.google.com with SMTP id fk26so3528459vcb.19 for ; Fri, 16 Nov 2012 19:31:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=n4PqxLSrtBFb2TQwhf1W/xw7SAjkXHtkT881Yu7uHxk=; b=HXAtfUY12N4T4zH5LYcqmpNcQR8k3RHA4QP1uhx4uFixXQEp92dyovXmywYpJZWCGc yDTwUEOXSZwNesOF+K1E9fFD7PP+HGmJKcOvugDLia4X/IIud42J2FQB9pemanPuKXZm j2P1zxZCh52MRt2VUvyyuK62u1mcHqDTvJGdibjf0aoo/VczBHXK/11wkwLWEphoNz2s AzblPeA8EVuXl/2LL9xFS2BB+kaH4ID4HWAdk9065b55bl4q43RK/qYfreqmN6vYXsLA TiUguPFlDCfbXrVPuHr6TMi/cMULyeM10BpRNRykhreq+L5CKxSWrxnarscymLLSgnBC NopA== Received: by 10.52.180.225 with SMTP id dr1mr8633208vdc.2.1353123115454; Fri, 16 Nov 2012 19:31:55 -0800 (PST) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id qj8sm1848321veb.2.2012.11.16.19.31.53 (version=SSLv3 cipher=OTHER); Fri, 16 Nov 2012 19:31:54 -0800 (PST) Date: Fri, 16 Nov 2012 22:31:51 -0500 From: Noah Misch To: Andres Freund Cc: Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: foreign key locks Message-ID: <20121117033151.GB24972@tornado.leadboat.com> References: <4FEAB90A0200002500048B7D@gw.wicourts.gov> <1346389151-sup-8379@alvh.no-ip.org> <20121018195820.GO3763@alvh.no-ip.org> <201210270006.54728.andres@2ndquadrant.com> <20121114152347.GA5161@alvh.no-ip.org> <20121114162726.GE5161@alvh.no-ip.org> <20121116002459.GB4347@tornado.leadboat.com> <20121116161747.GC4454@alvh.no-ip.org> <20121116163112.GF6505@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121116163112.GF6505@awork2.anarazel.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQmQx2u2DoJMcu9YGLMzm3RMRYY2+BFx/Y3GtNFxXGiHmo1ZC2gGUkPN98WbSWaENzQQEd0V X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201211/925 X-Sequence-Number: 216777 On Fri, Nov 16, 2012 at 05:31:12PM +0100, Andres Freund wrote: > On 2012-11-16 13:17:47 -0300, Alvaro Herrera wrote: > > Andres is on the verge of convincing me that we need to support > > singleton FOR SHARE without multixacts due to performance concerns. > > I don't really see any arguments against doing so. We aren't in a that > big shortage of flags and if we need more than available I think we can > free some (e.g. XMAX/XMIN_INVALID). The patch currently leaves two unallocated bits. Reclaiming currently-used bits means a binary compatibility break. Until we plan out such a thing, reclaimable bits are not as handy as never-allocated bits. I don't think we should lightly expend one of the final two. > > It > > would be useful for more people to chime in here: is FOR SHARE an > > important case to cater for? I wonder if using FOR KEY SHARE (keep > > performance characteristics, but would need to revise application code) > > would satisfy Andres' users, for example. > > It definitely wouldn't help in the cases I have seen because the point > is to protect against actual content changes of the rows, not just the > keys. > Note that you actually need to use explicit FOR SHARE/UPDATE for > correctness purposes in many scenarios unless youre running in 9.1+ > serializable mode. And that cannot be used in some cases (try queuing > for example) because the rollback rates would be excessive. I agree that tripling FOR SHARE cost is risky. Where is the added cost concentrated? Perchance that multiple belies optimization opportunities. Thanks, nm