Re: Will PQsetSingleRowMode get me results faster?

Поиск
Список
Период
Сортировка
От Dominique Devienne
Тема Re: Will PQsetSingleRowMode get me results faster?
Дата
Msg-id CAFCRh-9UGi+aKgC_VDvMrAZkqQ3X18xBD_De67qknQ1gf8J9bw@mail.gmail.com
обсуждение исходный текст
Ответ на Will PQsetSingleRowMode get me results faster?  (Stijn Sanders <stijnsanders@gmail.com>)
Список pgsql-general
On Mon, Jan 6, 2025 at 12:21 PM Stijn Sanders <stijnsanders@gmail.com> 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
helpto 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



В списке pgsql-general по дате отправления: