Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCWau-0008MY-ID for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jun 2016 18:28:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bCWat-0000oo-Qa for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Jun 2016 18:28:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bCWat-0000oi-HM for pgsql-bugs@postgresql.org; Mon, 13 Jun 2016 18:28:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bCWaq-0004fi-GR for pgsql-bugs@postgresql.org; Mon, 13 Jun 2016 18:28:15 +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 u5DIS5gP030235; Mon, 13 Jun 2016 14:28:05 -0400 From: Tom Lane To: Jeff Janes cc: Hubert Lubaczewski , Pg Bugs Subject: Re: PostgreSQL (9.3 and 9.6) eats all memory when using many tables In-reply-to: References: <20160609154610.GA20600@depesz.com> <20160613093907.GA10381@depesz.com> <4400.1465824992@sss.pgh.pa.us> Comments: In-reply-to Jeff Janes message dated "Mon, 13 Jun 2016 10:00:32 -0700" Date: Mon, 13 Jun 2016 14:28:05 -0400 Message-ID: <30233.1465842485@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jeff Janes writes: > On Mon, Jun 13, 2016 at 6:36 AM, Tom Lane wrote: >> While we have no direct experience with limiting the plancache size, >> I'd expect a pretty similar issue there: a limit will either do nothing >> except impose substantial bookkeeping overhead (if it's more than the >> number of plans in your working set) or it will result in a performance >> disaster from cache thrashing (if it's less). > We don't need to keep a LRU list or do a clock sweep or anything. We > could go really simple and just toss the whole thing into /dev/null > when it gets too large, and start over. Color me skeptical as heck. To the extent that you do have locality of reference, this would piss it away. Also, you can't just flush the plan cache altogether, not for PREPARE'd statements and not for internally-prepared ones either, because there are references being held for both of those. You could drop the plan tree, certainly, but that only goes so far in terms of reducing the amount of space needed. Dropping more than that risks subtle semantic changes, and would break API expectations of external PLs too. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs