Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XJWI5-00076g-TD for pgsql-performance@arkaria.postgresql.org; Mon, 18 Aug 2014 23:24:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XJWI5-0006xF-D2 for pgsql-performance@arkaria.postgresql.org; Mon, 18 Aug 2014 23:24:41 +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 1XJWI4-0006x8-Am for pgsql-performance@postgresql.org; Mon, 18 Aug 2014 23:24:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XJWI0-0003fF-2N for pgsql-performance@postgresql.org; Mon, 18 Aug 2014 23:24:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s7INOX7E012487; Mon, 18 Aug 2014 19:24:33 -0400 From: Tom Lane To: Kevin Grittner cc: Dave Owens , Merlin Moncure , Matheus de Oliveira , postgres performance list Subject: Re: query against pg_locks leads to large memory alloc In-reply-to: <1408399307.93048.YahooMailNeo@web122304.mail.ne1.yahoo.com> References: <1408399307.93048.YahooMailNeo@web122304.mail.ne1.yahoo.com> Comments: In-reply-to Kevin Grittner message dated "Mon, 18 Aug 2014 15:01:47 -0700" Date: Mon, 18 Aug 2014 19:24:33 -0400 Message-ID: <12486.1408404273@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) 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 Kevin Grittner writes: > Dave Owens wrote: >> max_connections = 450 ...we have found that we run out of shared >> memory when max_pred_locks_per_transaction is less than 30k. > It gathers the information in memory to return for all those locks > (I think both the normal heavyweight locks and the predicate locks > do that).  450 * 30000 is 13.5 million predicate locks you could > have, so they don't need a very big structure per lock to start > adding up.  I guess we should refactor that to use a tuplestore, so > it can spill to disk when it gets to be more than work_mem. Seems to me the bigger issue is why does he need such a huge max_pred_locks_per_transaction setting? It's hard to believe that performance wouldn't tank with 10 million predicate locks active. Whether you can do "select * from pg_locks" seems pretty far down the list of concerns about this setting. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance