Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XJndE-0006sN-5D for pgsql-performance@arkaria.postgresql.org; Tue, 19 Aug 2014 17:55:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XJndD-0007Ee-Lh for pgsql-performance@arkaria.postgresql.org; Tue, 19 Aug 2014 17:55:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XJndC-0007EY-S4 for pgsql-performance@postgresql.org; Tue, 19 Aug 2014 17:55:38 +0000 Received: from nm18-vm4.bullet.mail.ne1.yahoo.com ([98.138.91.178]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XJnd4-0007bX-Br for pgsql-performance@postgresql.org; Tue, 19 Aug 2014 17:55:37 +0000 Received: from [98.138.101.132] by nm18.bullet.mail.ne1.yahoo.com with NNFMP; 19 Aug 2014 17:55:27 -0000 Received: from [98.138.89.194] by tm20.bullet.mail.ne1.yahoo.com with NNFMP; 19 Aug 2014 17:55:27 -0000 Received: from [127.0.0.1] by omp1052.mail.ne1.yahoo.com with NNFMP; 19 Aug 2014 17:55:27 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 187233.61383.bm@omp1052.mail.ne1.yahoo.com Received: (qmail 56334 invoked by uid 60001); 19 Aug 2014 17:55:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1408470927; bh=F6pA12uy0/Szc1QhBy0BeuOlXoGNIuIOb0YQLLil9LE=; h=References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ss9osbzFfOcXHowEe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uwqAgV2UgYXJlIHJlZmFjdG9yaW5nIHRoZQo.IGFwcGxpY2F0aW9uIHJlc3BvbnNpYmxlIGZvciB0aGVzZSBsb25nIElETEUgdGltZXMsIHdoaWNoIHdpbGwKPiBob3BlZnVsbHkgcmVkdWNlIHRoZSBkdXJhdGlvbiBvZiB0aGVpciBjb25uZWN0aW9ucy4KClRoYXQgbWF5IGgBMAEBAQE- X-Mailer: YahooMailWebService/0.8.201.700 References: <1408399307.93048.YahooMailNeo@web122304.mail.ne1.yahoo.com> <12486.1408404273@sss.pgh.pa.us> <1408448332.31825.YahooMailNeo@web122302.mail.ne1.yahoo.com> <1408466441.59082.YahooMailNeo@web122304.mail.ne1.yahoo.com> Message-ID: <1408470926.74229.YahooMailNeo@web122303.mail.ne1.yahoo.com> Date: Tue, 19 Aug 2014 10:55:26 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: query against pg_locks leads to large memory alloc To: Dave Owens Cc: Tom Lane , 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 do see a handful of backends that like to stay IDLE in > transaction for minutes at a time.=A0 We are refactoring the > application responsible for these long IDLE times, which will > hopefully reduce the duration of their connections. That may help some.=A0 Other things to consider: =A0- If you can use a connection pooler in transaction mode to reduce the number of active connections you may be able to improve performance all around, and dodge this problem in the process. Very few systems can make efficient use of hundreds of concurrent connections, but for various reasons fixing that with a connection pooler is sometimes difficult. =A0- If you have transactions (or SELECT statements that you run outside of explicit transactions) which you know will not be modifying any data, flagging them as READ ONLY will help contain the number of predicate locks and will help overall performance. (If the SELECT statements are not in explicit transactions, you may have to put them in one to allow the READ ONLY property to be set, or set default_transaction_read_only in the session to accomplish this.) =A0- Due to the heuristics used for thresholds for combining fine-grained locks into coarser ones, you might be able to work around this by boosting max_connections above the number you are going to use.=A0 Normally when you increase max_pred_locks_per_transaction it increases the number of page locks it will allow in a table or index before it combines them into a relation lock; increasing max_connections doesn't affect the granularity promotion threshold, but it increases the total number of predicate locks allowed, so if you boost that and reduce max_pred_locks_per_transaction in proportion, you may be able to dodge the problem.=A0 It's an ugly workaround, but it might get you into better shape.=A0 If that does work, it's good evidence that we should tweak those heuristics. -- 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