public inbox for pgsql-interfaces@postgresql.org
help / color / mirror / Atom feedFrom: Daniel Verite <daniel@manitou-mail.org>
To: Tim Fors <tim4stheenchanter@gmail.com>
Cc: pgsql-interfaces@lists.postgresql.org
Subject: Re: ECPG support for PQsetChunkedRowsMode()
Date: Mon, 24 Nov 2025 13:41:40 +0100
Message-ID: <d22379c8-7777-4ba1-9261-89ab5f5de2dd@manitou-mail.org> (raw)
In-Reply-To: <CAOjiQ0C8O4g_KcVmOMq_+WJy+YCugBYe8A=RsZgHGP1nfhQG=g@mail.gmail.com>
Tim Fors wrote:
> Note that ECPG supports using a C array as a host variable, and in
> that case there's a bulk transfer of rows from the client to the
> server, so performance is much better than getting the rows one at a
> time using a cursor. However, AFAIK this is not standard coding
> practice - one expects to be able to use the cursor to FETCH one
> row at a time, but still offer good performance.
It's just a preprocessor. If the C code has EXEC SQL FETCH NEXT, it's
going to emit code sending a FETCH NEXT [1] SQL statement.
But aside from the arrays you mention, it allows retrieving several
rows at a time through a cursor, so the client-side can still reduce
the round-trips to the server. See this example in [2]:
EXEC SQL FETCH 3 FROM mycursor INTO DESCRIPTOR mysqlda;
[1]: https://www.postgresql.org/docs/current/sql-fetch.html
[2]: https://www.postgresql.org/docs/current/ecpg-descriptors.html
Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
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-interfaces@postgresql.org
Cc: daniel@manitou-mail.org, tim4stheenchanter@gmail.com, pgsql-interfaces@lists.postgresql.org
Subject: Re: ECPG support for PQsetChunkedRowsMode()
In-Reply-To: <d22379c8-7777-4ba1-9261-89ab5f5de2dd@manitou-mail.org>
* 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