public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dominique Devienne <[email protected]>
To: Stijn Sanders <[email protected]>
Cc: [email protected]
Subject: Re: Will PQsetSingleRowMode get me results faster?
Date: Mon, 6 Jan 2025 12:54:41 +0100
Message-ID: <CAFCRh-9UGi+aKgC_VDvMrAZkqQ3X18xBD_De67qknQ1gf8J9bw@mail.gmail.com> (raw)
In-Reply-To: <CAHYFsWWPQZj4J5=AE7b=zrY31Nkff-=D8O6=tXx-MiO83K6FJg@mail.gmail.com>
References: <CAHYFsWWPQZj4J5=AE7b=zrY31Nkff-=D8O6=tXx-MiO83K6FJg@mail.gmail.com>

On Mon, Jan 6, 2025 at 12:21 PM Stijn Sanders <[email protected]> wrote:
> 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.

I haven't used single-row-mode myself, but I can tell you that using a
cursor instead of a statement allows you to reduce your
time-to-first-row. But at the expense of overall performance, i.e. in
my (limited) testing, getting the whole result-set in one go is faster
than getting the same rows via a cursor, even in varying chunk sizes.
Another alternative is to use COPY, which gets your the rows as they
come, but then you're on your own to "decode" the row and its
select-clause. FWIW. --DD






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Will PQsetSingleRowMode get me results faster?
  In-Reply-To: <CAFCRh-9UGi+aKgC_VDvMrAZkqQ3X18xBD_De67qknQ1gf8J9bw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox