Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTenv-0004K8-2s for pgsql-hackers@postgresql.org; Wed, 31 Oct 2012 20:22:23 +0000 Received: from smtprelay0029.b.hostedemail.com ([64.98.42.29] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTenn-0002R3-Tf for pgsql-hackers@postgresql.org; Wed, 31 Oct 2012 20:22:22 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay03.b.hostedemail.com (Postfix) with SMTP id C5577285648A; Wed, 31 Oct 2012 20:22:13 +0000 (UTC) X-Panda: scanned! X-Spam-Summary: 50, 0, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::::::::, RULES_HIT:355:379:599:601:800:945:960:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1358:1359:1437:1515:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2379:2393:2525:2553:2560:2563:2682:2685:2693:2828:2859:2895:2898:2933:2937:2939:2942:2945:2947:2951:2954:3022:3027:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4605:4659:5007:6261:7679:7809:7903:8660:8784:9025:9121:10004:10400:10848:11256:11257:11658:11914:12517:12519:12740, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Filterd-Recvd-Size: 2983 Received: from perhan.alvh.no-ip.org (unknown [190.95.26.194]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf07.b.hostedemail.com (Postfix) with ESMTPA; Wed, 31 Oct 2012 20:22:12 +0000 (UTC) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 539A76E047; Wed, 31 Oct 2012 17:22:10 -0300 (CLST) Date: Wed, 31 Oct 2012 17:22:10 -0300 From: Alvaro Herrera To: Simon Riggs Cc: Noah Misch , Kevin Grittner , Andres Freund , pgsql-hackers@postgresql.org Subject: Re: foreign key locks Message-ID: <20121031202209.GF23139@alvh.no-ip.org> References: <20121029121833.306930@gmx.com> <20121031193536.GA1651@tornado.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/1613 X-Sequence-Number: 215849 Simon Riggs wrote: > On 31 October 2012 19:35, Noah Misch wrote: > > On Mon, Oct 29, 2012 at 08:18:33AM -0400, Kevin Grittner wrote: > >> Andres Freund wrote: > >> > The point is the introduction of a weaker lock level which can be > >> > used by the ri triggers. I don't see any imperative that the > >> > semantics of the old lock level need to be redefined. That just > >> > seems dangerous to me. > >> > >> I agree with Andres here -- the new lock level is needed within RI > >> triggers, and we might as well expose it for application programmer > >> use (with proper documentations), but there's no reason to break > >> existing application code by making the semantics of SELECT FOR > >> UPDATE less strict than they were before. Let's keep that term > >> meaning exactly the same thing if we can, and use new names for the > >> new levels. > > > > +1. I had not considered this angle during previous reviews, but I a= gree with > > Andres's position. Since this patch does not strengthen the stronges= t tuple > > lock relative to its PostgreSQL 9.2 counterpart, that lock type shoul= d > > continue to use the syntax "FOR UPDATE". It will come to mean "the l= ock type > > sufficient for all possible UPDATEs of the row". Yeah, I agree with this too. > So we have syntax >=20 > FOR NON KEY UPDATE > FOR KEY UPDATE >=20 > KEY is the default, so FOR UPDATE is a synonym of FOR KEY UPDATE Not really sure about the proposed syntax, but yes clearly we need some other syntax to mean "FOR NON KEY UPDATE". I would rather keep FOR UPDATE to mean what I currently call FOR KEY UPDATE. More proposals for the other (weaker) lock level welcome (but if you love FOR NON KEY UPDATE, please chime in too) --=20 =C1lvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services