From: | Stijn Sanders <stijnsanders(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Will PQsetSingleRowMode get me results faster? |
Date: | 2025-01-05 21:11:16 |
Message-ID: | CAHYFsWWPQZj4J5=AE7b=zrY31Nkff-=D8O6=tXx-MiO83K6FJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've been using LibPQ to get data from PostgreSQL instances with great
success.
I'm using PQsendQuery and PQgetResult, but noticed there's
also PQsetSingleRowMode.
The documentation is clearly stating it only benefits a limited set of
scenario's, but I'm saddened that it can't help to get the first resulte of
a (longer running) query faster.
There's a different database solution I won't name here that has a thing
they call 'firehose mode' that in fact does this: their equivalent
of PQntuples actually returns -1 in this mode, and you're expected to use
their equivalent of PQgetResult to get record per record ** as it is
rolling in from the server while the query is still running **.
From what I notice using LibPQ, it appears a query needs to complete before
resulting data is being transferred to the client. Please correct me if I'm
wrong.
Please point me in the correct direction if I'm missing something and I
need to look elsewhere. (I just now notice there's a PQsetChunkedRowsMode
now —nice! — but I suspect the above still holds.)
Should I attempt to use LIMIT and OFFSET to limit the running time of
queries to get results faster? This will still interrupt the query and add
overhead of starting and stopping each query, even using PQexecPrepared, I
guess...
Greetings
Stijn
From | Date | Subject | |
---|---|---|---|
Next Message | Nick | 2025-01-06 00:27:15 | Questions about the Debian Package version of pgAdmin |
Previous Message | Jan Behrens | 2025-01-05 10:43:21 | Re: search_path for PL/pgSQL functions partially cached? |