Re: how to limit statement memory allocation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Radoslav Nedyalkov <rnedyalkov(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to limit statement memory allocation
Date: 2021-03-09 16:03:40
Message-ID: 2022857.1615305820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Radoslav Nedyalkov <rnedyalkov(at)gmail(dot)com> writes:
> Occasionally we get bad queries on our db that consume a lot of memory.
> These typically are full joins by mistake or just too large result sets.
> My understanding is these should go to a temp file but apparently memory
> allocation is preferred.

Perhaps the accumulation is happening on the client side? libpq doesn't
have any provision for spilling a result set to disk.

If that's it, you could consider revising your application to read results
row-at-a-time, although that might require a good deal of effort.

https://www.postgresql.org/docs/current/libpq-single-row-mode.html

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2021-03-09 16:24:59 Re: SV: Log files polluted with permission denied error messages after every 10 seconds
Previous Message Radoslav Nedyalkov 2021-03-09 15:35:35 how to limit statement memory allocation