From: Tom Lane <tgl@sss.pgh.pa.us>
To: dmigowski@ikoffice.de
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14726: Memory consumption of PreparedStatement
Date: Sun, 02 Jul 2017 12:36:26 -0400
Message-ID: <29649.1499013386@sss.pgh.pa.us> (raw)
In-Reply-To: <20170702090956.1469.41812@wrigleys.postgresql.org>
References: <20170702090956.1469.41812@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
dmigowski@ikoffice.de writes:
> I concluded that the query plan of the statement, which I uploaded to despez
> would result in 30MB of memory footprint!
> https://explain.depesz.com/s/gN2
Really? There's 132 plan nodes in that plan. I could believe that we're
eating several KB per plan node, but not 220KB per node.
> * How can I determine the memory footprint of prepared statements?
It's not something we track specifically.
> * Wouldn't it be useful if we could give a memory limit for prepared
> statements on the server, so that PostgreSQL automatically evicts them if
> more are prepared, maybe by using an LRU list?
I'd be against that, as it pretty much would destroy the point of having
prepared statements at all --- if the server forgets them at random, or
even just has to re-prepare them unexpectedly, it's not holding up its
end of the contract. It's the application's job to use that resource
in a prudent manner, just like any other SQL resource.
> PostgreSQL could automatically replan them when they get used again, I
> think.
This view seems like a poster child for why that would be a bad idea
--- that query has to take a mighty long time to plan.
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, dmigowski@ikoffice.de
Subject: Re: BUG #14726: Memory consumption of PreparedStatement
In-Reply-To: <29649.1499013386@sss.pgh.pa.us>
References: <20170702090956.1469.41812@wrigleys.postgresql.org> <29649.1499013386@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox