Re: PATCH: Batch/pipelining support for libpq

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>,"Matthieu Garrigues" <matthieu(dot)garrigues(at)gmail(dot)com>,"Michael Paquier" <michael(at)paquier(dot)xyz>,"Dave Cramer" <davecramer(at)postgres(dot)rocks>,"PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>,"Craig Ringer" <craig(at)2ndquadrant(dot)com>,"Vaishnavi Prabakaran" <vaishnaviprabakaran(at)gmail(dot)com>,"Andres Freund" <andres(at)anarazel(dot)de>,"Michael Paquier" <michael(dot)paquier(at)gmail(dot)com>,"Claudio Freire" <klaussfreire(at)gmail(dot)com>,"Heikki Linnakangas" <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: PATCH: Batch/pipelining support for libpq
Date: 2020-11-14 14:42:50
Message-ID: b27523b8-6e41-44e8-8cc6-ea136316cdcd@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:

> I adapted the test code to our code style. I also removed the "timings"
> stuff; I think that's something better left to pgbench.
>
> (I haven't looked at Daniel's pgbench stuff yet, but I will do that
> next.)

The patch I posted in [1] was pretty simple, but at the time, query
results were always discarded. Now that pgbench can instantiate
variables from query results, a script can do:
select 1 as var \gset
select :var;
This kind of sequence wouldn't work in batch mode since it
sends queries before getting results of previous queries.

So maybe \gset should be rejected when inside a batch section.

Or alternatively pgbench should collect results before a variable is
reinjected into a query, thereby stalling the pipeline.
To do this only when necessary, it would have to track read-write
dependencies among variables, which seems overly complicated though.

[1]
https://www.postgresql.org/message-id/b4e34135-2bd9-4b8a-94ca-27d760da26d7@manitou-mail.org

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2020-11-14 15:53:17 Re: pgbench: option delaying queries till connections establishment?
Previous Message Marina Polyakova 2020-11-14 13:48:51 Re: pgbench: option delaying queries till connections establishment?