Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNbbG-0006KZ-Gg for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2016 08:02:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bNbbG-0006vJ-42 for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jul 2016 08:02:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bNbbF-0006vD-MC for pgsql-hackers@postgresql.org; Thu, 14 Jul 2016 08:02:25 +0000 Received: from boipeva.ensmp.fr ([194.214.158.136]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNbbC-0006TM-BQ for pgsql-hackers@postgresql.org; Thu, 14 Jul 2016 08:02:25 +0000 Received: from cri.ensmp.fr (AGrenoble-653-1-69-83.w92-129.abo.wanadoo.fr [92.129.7.83]) (authenticated bits=0) by boipeva.ensmp.fr (8.15.2/8.15.1/JMMC-22/Oct/2013) with ESMTPSA id u6E82IC1004079 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 14 Jul 2016 10:02:19 +0200 Date: Thu, 14 Jul 2016 10:02:18 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@sto To: Tom Lane cc: Robert Haas , Pavel Stehule , PostgreSQL Developers Subject: Re: pgbench - allow to store select results into variables In-Reply-To: <32184.1468440143@sss.pgh.pa.us> Message-ID: References: <32184.1468440143@sss.pgh.pa.us> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Miltered: at boipeva.ensmp.fr with ID 5787470A.000 by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Auth: USER-ID fabien.coelho X-j-chkmail-Enveloppe: 5787470A.000 from AGrenoble-653-1-69-83.w92-129.abo.wanadoo.fr/AGrenoble-653-1-69-83.w92-129.abo.wanadoo.fr/92.129.7.83/cri.ensmp.fr/ X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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