Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3814462E9C1 for ; Mon, 5 Oct 2009 19:11:04 -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 66274-01 for ; Mon, 5 Oct 2009 22:10:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og112.obsmtp.com (exprod7og112.obsmtp.com [64.18.2.177]) by mail.postgresql.org (Postfix) with SMTP id E08806341EB for ; Mon, 5 Oct 2009 19:10:52 -0300 (ADT) Received: from source ([209.85.221.172]) by exprod7ob112.postini.com ([64.18.6.12]) with SMTP ID DSNKSspu6apxNJMjRxSNzddBN2z2/bm2/r9w@postini.com; Mon, 05 Oct 2009 15:10:52 PDT Received: by qyk2 with SMTP id 2so3228733qyk.21 for ; Mon, 05 Oct 2009 15:10:49 -0700 (PDT) Received: by 10.224.110.210 with SMTP id o18mr639436qap.383.1254780648970; Mon, 05 Oct 2009 15:10:48 -0700 (PDT) Received: from ?172.28.172.6? (173-14-134-253-NewEngland.hfc.comcastbusiness.net [173.14.134.253]) by mx.google.com with ESMTPS id 26sm104007qwa.20.2009.10.05.15.10.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 05 Oct 2009 15:10:47 -0700 (PDT) Message-ID: <4ACA6EDE.4020407@enterprisedb.com> Date: Tue, 06 Oct 2009 01:10:38 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: Simon Riggs CC: pgsql-hackers Subject: Re: Hot Standby on git References: <1253958559.4449.833.camel@ebony.2ndQuadrant> <4ABF4522.6060601@enterprisedb.com> <1254743455.4691.153.camel@ebony.2ndQuadrant> In-Reply-To: <1254743455.4691.153.camel@ebony.2ndQuadrant> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/357 X-Sequence-Number: 147169 Simon Riggs wrote: > We discussed briefly your change > 0011-Replace-per-proc-counters-of-loggable-locks-with-per.patch. > > I don't see how that helps at all. The objective of lock counters was to > know if we can skip acquiring an LWlock on all lock partitions. This > change keeps the lock counters yet acquires the locks we were trying to > avoid. This change needs some justification since it is not a bug fix. Well, the original code was buggy. But more to the point, it's a lot simpler this way, I don't see any reason why the counters should be per-process, meaning that they need to be exposed in the pgproc structs or procarray.c. The point is to avoid the seqscan of the lock hash table. I presumed that's the expensive part in GetRunningTransactionLocks(). Tom Lane wrote: > [ scratches head ... ] Why is hot standby messing with this sort of > thing at all? It sounds like a performance optimization that should > be considered separately, and *later*. Yeah, I too considered just ripping it out. Simon is worried that locking all the lock partitions and scanning the locks table can take a long time. We do that in the master, while holding both ProcArrayLock and XidGenLock in exclusive mode (hmm, why is shared not enough?), so there is some grounds for worry. OTOH, it's only done once per checkpoint. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com