Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id A3182633A58 for ; Wed, 18 Mar 2009 17:26:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 80527-06 for ; Wed, 18 Mar 2009 17:26:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 2C8396339E6 for ; Wed, 18 Mar 2009 17:26:52 -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 n2IKQjYT015145; Wed, 18 Mar 2009 16:26:45 -0400 (EDT) To: Simon Riggs cc: Matthew Wakeling , "pgsql-performance@postgresql.org" Subject: Re: Proposal of tunable fix for scalability of 8.4 In-reply-to: <1237362833.3953.186.camel@ebony.2ndQuadrant> References: <603c8f070903121829r31cf1472ha9876e5c480a542e@mail.gmail.com> <12292.1236964604@sss.pgh.pa.us> <49BB699D.1070809@enterprisedb.com> <1237362833.3953.186.camel@ebony.2ndQuadrant> Comments: In-reply-to Simon Riggs message dated "Wed, 18 Mar 2009 07:53:53 -0000" Date: Wed, 18 Mar 2009 16:26:45 -0400 Message-ID: <15144.1237408005@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL=0.011 X-Spam-Level: X-Archive-Number: 200903/256 X-Sequence-Number: 33178 Simon Riggs writes: > On Mon, 2009-03-16 at 16:26 +0000, Matthew Wakeling wrote: >> One possibility would be for the locks to alternate between exclusive >> and >> shared - that is: >> >> 1. Take a snapshot of all shared waits, and grant them all - >> thundering >> herd style. >> 2. Wait until ALL of them have finished, granting no more. >> 3. Take a snapshot of all exclusive waits, and grant them all, one by >> one. >> 4. Wait until all of them have been finished, granting no more. >> 5. Back to (1) > I agree with that, apart from the "granting no more" bit. > Currently we queue up exclusive locks, but there is no need to since for > ProcArrayLock commits are all changing different data. > The most useful behaviour is just to have two modes: > * exclusive-lock held - all other x locks welcome, s locks queue > * shared-lock held - all other s locks welcome, x locks queue My goodness, it seems people have forgotten about the "lightweight" part of the LWLock design. regards, tom lane