Re: ECPG support for PQsetChunkedRowsMode()

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Tim Fors" <tim4stheenchanter(at)gmail(dot)com>
Cc: pgsql-interfaces(at)lists(dot)postgresql(dot)org
Subject: Re: ECPG support for PQsetChunkedRowsMode()
Date: 2025-11-24 12:41:40
Message-ID: d22379c8-7777-4ba1-9261-89ab5f5de2dd@manitou-mail.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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/

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tim Fors 2025-11-24 18:58:43 Re: ECPG support for PQsetChunkedRowsMode()
Previous Message Tim Fors 2025-11-21 21:35:51 Re: ECPG support for PQsetChunkedRowsMode()