čt 16. 3. 2023 v 9:18 odesílatel Dominique Devienne <ddevienne@xxxxxxxxx> napsal:
On Thu, Mar 16, 2023 at 6:48 AM Laurenz Albe <laurenz.albe@xxxxxxxxxxx> 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 / Queriesfrom a LIBPQ client application perspective, on the same "streamable" queries (i.e. w/o a sort), Cursorshined in terms of time-to-first-row, compared to waiting for the whole ResultSet, but getting the full resultOTOH 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
cursors are optimized for minimal cost of first row, queries are optimized for minimal cost of last row
Regards
Pavel
PS: In my testing, I used forward-only cursorsPPS: I don't recall the ResultSet cardinality or byte size, nor the batching used with the Cursor.