agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: Brice André <brice@famille-andre.be>
Cc: pgsql-sql@postgresql.org
Subject: Re: Memory exhaustion on large query
Date: Sun, 12 Dec 2021 13:43:51 -0500
Message-ID: <106300.1639334631@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOBG12=T1G2Fv116PKS7NTAS2GDdFVfADuETgunJbQvRhL=P0Q@mail.gmail.com>
References: <CAOBG12=T1G2Fv116PKS7NTAS2GDdFVfADuETgunJbQvRhL=P0Q@mail.gmail.com>
=?UTF-8?B?QnJpY2UgQW5kcsOp?= <brice@famille-andre.be> writes:
> The content of the table is so huge that, if PQsendQueryPrepared retrieves
> all data, or if postgresql engine is creating temp file with all data, the
> query cannot succeed (I have no enough RAM or disk space to copy the whole
> data). But I was expecting that using PQsendQueryPrepared and PQgetResult
> would avoid this by returning one result at a time.
You're confusing asynchronous mode with single-row mode. Async mode,
per se, doesn't change memory consumption; it just lets you do something
else while waiting for the query result. You are (I suppose) missing
a call to PQsetSingleRowMode --- see
https://www.postgresql.org/docs/current/libpq-single-row-mode.html
regards, tom lane
view thread (4+ messages) latest in thread
Message-ID: <106300.1639334631@sss.pgh.pa.us>
Permalink: ../106300.1639334631@sss.pgh.pa.us/
Also on: postgresql.org/message-id/106300.1639334631@sss.pgh.pa.us
reply
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, brice@famille-andre.be
Subject: Re: Memory exhaustion on large query
In-Reply-To: <106300.1639334631@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox