From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: pgbench - allow to store select results into variables
Date: Thu, 14 Jul 2016 10:02:18 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1607140925400.1962@sto> (raw)
In-Reply-To: <32184.1468440143@sss.pgh.pa.us>
References: <alpine.DEB.2.20.1607091005330.3412@sto>
<CAFj8pRAgU0OzGM7Vqpf2KUR0KP2YNhtG54ji06W5StGmwyQKnA@mail.gmail.com>
<alpine.DEB.2.20.1607091057300.3412@sto>
<CAFj8pRBGrdiroRyJgCjtOmOrHCQu0L8KDGLU5czD2q+jF8bUxQ@mail.gmail.com>
<alpine.DEB.2.20.1607091441480.3412@sto>
<CA+TgmoaFOUVh5E5qbMjV6L6ub1NFML7U+4Cx+8CvLQgRPrO4Ng@mail.gmail.com>
<32184.1468440143@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hello Tom,
>>> SELECT 1, 2 \; SELECT 3;
>>> \into one two three
>
> Yeah, that's seriously nasty action-at-a-distance in my view. I'd be okay
> with
>
> SELECT 1, 2 \into one two
> SELECT 3 \into three
ISTM that is not the same, because then you would have two queries (over
the network) instead of one, so you pay the network latency twice?
> but I do not think that a metacommand on a following line should
> retroactively affect the execution of a prior command, much less commands
> before the last one.
Nope. The meta-command applies to the preceeding SQL command... which
happens to be a \;-compound command. ISTM that all is logically fine.
Some motivation about the feature (not its syntax or implementation), from
a benchmarking perspective:
- clients MUST read the server answers and possibly reuse them, hence a
proposed \into feature. Discarding the answer as pgbench does not really
comply with typical benchmark rules, eg from tpc-b:
"""1.3.2 Each transaction shall return to the driver the Account_Balance
resulting from successful commit of the transaction.
Comment: It is the intent of this clause that the account balance in the
database be returned to the driver, i.e., that the application retrieve
the account balance."""
- latency is important to applications (eg web applications), thus the
ability to compound statements is a good thing. However, if in a bench one
can compound statements but not retrieve their values, it fails the
previous "retrieve the value" requirement.
So basically I wish to avoid splitting compound queries and paying latency
just because of a lack of syntax to do the right thing, hence the proposed
feature which can retrieve data from various parts of a compound
statement.
--
Fabien.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: pgsql-hackers@postgresql.org
Cc: coelho@cri.ensmp.fr, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pavel.stehule@gmail.com
Subject: Re: pgbench - allow to store select results into variables
In-Reply-To: <alpine.DEB.2.20.1607140925400.1962@sto>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox