Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKAPg-0001fg-7C for pgsql-performance@arkaria.postgresql.org; Wed, 20 Aug 2014 18:15:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XKAPf-0007sP-Mt for pgsql-performance@arkaria.postgresql.org; Wed, 20 Aug 2014 18:15:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XKAPe-0007q0-7d for pgsql-performance@postgresql.org; Wed, 20 Aug 2014 18:15:10 +0000 Received: from nm13-vm5.bullet.mail.ne1.yahoo.com ([98.138.91.235]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XKAPY-0004Jc-Sx for pgsql-performance@postgresql.org; Wed, 20 Aug 2014 18:15:08 +0000 Received: from [98.138.100.111] by nm13.bullet.mail.ne1.yahoo.com with NNFMP; 20 Aug 2014 18:15:03 -0000 Received: from [98.138.89.195] by tm100.bullet.mail.ne1.yahoo.com with NNFMP; 20 Aug 2014 18:15:03 -0000 Received: from [127.0.0.1] by omp1053.mail.ne1.yahoo.com with NNFMP; 20 Aug 2014 18:15:03 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 283617.12565.bm@omp1053.mail.ne1.yahoo.com Received: (qmail 26147 invoked by uid 60001); 20 Aug 2014 18:15:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1408558503; bh=zUYogW6IrjWG+8LdBsAfpBCYdHYk1Zze4dEvB7o3AAc=; h=References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Tsc32qjzgOFPHnQ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cm9tIHBnX3N0YXRfYWN0aXZpdHkgYW5kCj4gcGdfbG9ja3MgKDE2IHNuYXBzaG90cyBmcm9tIGVhY2ggdGFibGUvdmlldykuwqAgSSBoYXZlIHR1cm5lZCBvZmYKPiBjb2xsZWN0aW9uIGF0IHRoaXMgcG9pbnQsIGJ1dCBJIGFtIHN0aWxsIGFibGUgdG8gcXVlcnkgcGdfbG9ja3MKCkNvdWxkIHlvdSB0YWtlIHRoZSBlYXJsaWVzdCBvbmUgYWZ0ZXIgYWN0aXZpdHkgc3QBMAEBAQE- X-Mailer: YahooMailWebService/0.8.201.700 References: <20140819171710.GA15735@awork2.anarazel.de> <1408471302.64928.YahooMailNeo@web122302.mail.ne1.yahoo.com> <1408473810.64930.YahooMailNeo@web122304.mail.ne1.yahoo.com> Message-ID: <1408558502.11006.YahooMailNeo@web122302.mail.ne1.yahoo.com> Date: Wed, 20 Aug 2014 11:15:02 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: query against pg_locks leads to large memory alloc To: Dave Owens Cc: Andres Freund , Merlin Moncure , Matheus de Oliveira , postgres performance list In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Dave Owens wrote: > I now have 8 hours worth of snapshots from pg_stat_activity and > pg_locks (16 snapshots from each table/view).=A0 I have turned off > collection at this point, but I am still able to query pg_locks Could you take the earliest one after activity started, and the latest one before you stopped collecting them, compress them, and email them to me off-list, please? > SIReadLocks continue to grow.=A0 It seems, in general, that our > application code over uses Serializable... we have produced a patch > that demotes some heavy-hitting queries down to Read Committed, and we > will see if this makes an impact on the number of SIReadLocks. Do all of those modify data?=A0 If not, you may get nearly the same benefit from declaring them READ ONLY instead, and that would get better protection against seeing transient invalid states.=A0 One=20 example of that is here: http://wiki.postgresql.org/wiki/SSI#Deposit_Report > Is it interesting that only 101557 out of 7 million SIReadLocks have a > pid associated with them? I would need to double-check that I'm not forgetting another case, but the two cases I can think of where the pid is NULL are if the transaction is PREPARED (for two phase commit) or if committed transactions are summarized (so they can be combined) to try to limit RAM usage.=A0 We might clear the pid if the connection is closed, but (without having checked yet) I don't think we did that. Since you don't use prepared transactions, they are probably from the summarization.=A0 But you would not normally accumulate much there unless you have a long-running transaction which is not flagged as READ ONLY. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance