AW: BUG #15923: Prepared statements take way too much memory. - Mailing list pgsql-bugs

From Daniel Migowski
Subject AW: BUG #15923: Prepared statements take way too much memory.
Date
Msg-id 41ED3F5450C90F4D8381BC4D8DF6BBDCF02D9F0C@EXCHANGESERVER.ikoffice.de
Whole thread Raw
In response to Re: BUG #15923: Prepared statements take way too much memory.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses AW: BUG #15923: Prepared statements take way too much memory.  (Daniel Migowski <dmigowski@ikoffice.de>)
List pgsql-bugs
I never keep more that 250 Prepared Statements. Sadly, with 10 connections to the database pooled, this is too much to
handlefor my poor servers.  

But really... 45MB? The query has 132 nodes, and each takes up 300kb memory? Do you store the table contents in that
thing?I don't want to be greedy, but might it be possible to store your Prepared Statements in a data structure that is
slightlyless memory hungry?  

Regards and many thanks ahead,
Daniel Migowski

-----Ursprüngliche Nachricht-----
Von: Tom Lane <tgl@sss.pgh.pa.us>
Gesendet: Donnerstag, 25. Juli 2019 00:24
An: Daniel Migowski <dmigowski@ikoffice.de>
Cc: pgsql-bugs@lists.postgresql.org
Betreff: Re: BUG #15923: Prepared statements take way too much memory.

PG Bug reporting form <noreply@postgresql.org> writes:
> Prepared Statements take too much memory.

I'm not really sure what you expect us to do about this.  If you PREPARE a bunch of statements and never DEALLOCATE
them,then yes they're going to consume memory; maybe a lot of memory if the plans are complex. 

The only thing we could do to reduce the memory consumption is to throw away the plans, which kind of defeats the
purposeof a prepared statement, wouldn't you say?  And even holding onto enough information to re-create the plan later
wouldconsume some amount of memory, so you will still have a problem if you keep making prepared statements and never
releasethem. 

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15923: Prepared statements take way too much memory.
Next
From: Andres Freund
Date:
Subject: Re: ERROR: virtual tuple table slot does not have system attributes