Re: Is the PL/pgSQL refcursor useful in a modern three-tier app? - Mailing list pgsql-general

From Dominique Devienne
Subject Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?
Date
Msg-id CAFCRh-8YnsZCEtzqfyr33mZd9gbR7vg45hFu8aqH5Eha3Cj6Gw@mail.gmail.com
Whole thread Raw
In response to Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general
On Thu, Mar 16, 2023 at 6:48 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
As we wrote, some of us think that cursors are useful, and we tried to
explain why we think that.  If you don't think that cursors are useful,
don't use them.  We are not out to convince you otherwise.

Perhaps OT (I only skimed this thread) but when I compared Cursors to regular Statements / Queries
from a LIBPQ client application perspective, on the same "streamable" queries (i.e. w/o a sort), Cursor
shined in terms of time-to-first-row, compared to waiting for the whole ResultSet, but getting the full result
OTOH was 2x as long with Cursor, compared to the regular SELECT Statement.

Thus in my mind, it really depends on what you value in a particular situation, latency or throughput. --DD

PS: In my testing, I used forward-only cursors
PPS: I don't recall the ResultSet cardinality or byte size, nor the batching used with the Cursor.

pgsql-general by date:

Previous
From: Jon Erdman
Date:
Subject: Re: valgrind a background worker
Next
From: Pavel Stehule
Date:
Subject: Re: Is the PL/pgSQL refcursor useful in a modern three-tier app?