AW: BUG #15923: Prepared statements take way too much memory.

From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: AW: BUG #15923: Prepared statements take way too much memory.
Date: 2019-07-24 22:32:15
Message-ID: 41ED3F5450C90F4D8381BC4D8DF6BBDCF02D9F0C@EXCHANGESERVER.ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I never keep more that 250 Prepared Statements. Sadly, with 10 connections to the database pooled, this is too much to handle for 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 slightly less memory hungry?

Regards and many thanks ahead,
Daniel Migowski

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

PG Bug reporting form <noreply(at)postgresql(dot)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 purpose of a prepared statement, wouldn't you say? And even holding onto enough information to re-create the plan later would consume some amount of memory, so you will still have a problem if you keep making prepared statements and never release them.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2019-07-25 01:54:48 Re: ERROR: virtual tuple table slot does not have system attributes
Previous Message Tom Lane 2019-07-24 22:23:45 Re: BUG #15923: Prepared statements take way too much memory.