Will PQsetSingleRowMode get me results faster? - Mailing list pgsql-general

From Stijn Sanders
Subject Will PQsetSingleRowMode get me results faster?
Date
Msg-id CAHYFsWWPQZj4J5=AE7b=zrY31Nkff-=D8O6=tXx-MiO83K6FJg@mail.gmail.com
Whole thread Raw
Responses Re: Will PQsetSingleRowMode get me results faster?
Re: Will PQsetSingleRowMode get me results faster?
List 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

pgsql-general by date:

Previous
From: Jan Behrens
Date:
Subject: Re: search_path for PL/pgSQL functions partially cached?
Next
From: Nick
Date:
Subject: Questions about the Debian Package version of pgAdmin