Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lw6BN-0006KH-M3 for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Jun 2021 16:56:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lw6BM-0003Hn-Bt for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Jun 2021 16:56:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lw6AG-0002hy-DO for pgsql-hackers@lists.postgresql.org; Wed, 23 Jun 2021 16:55:48 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lw6AC-0000RP-Ce for pgsql-hackers@lists.postgresql.org; Wed, 23 Jun 2021 16:55:47 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id r19so1782641qvw.5 for ; Wed, 23 Jun 2021 09:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=C1t3AHaP6cSe+cH+c+bTuQp0YEJpMrzkSxQbGOquuRU=; b=t/CxGkieQRxSBpsfK9Bek19uWZF8JMMZ50aMdyJ4YUZ/I7bVIORjECUgvuF6Cifa1/ 4BQV897FzBpH3MbURME8oCs2dbawRuTUEmNe4r2b6/t6wjjx/MLIh3QZGRCpKQnwETwm 5+jwW7pkYXNn0CF9SpUm+oGIxbtlwDsmuVKFieYxs+qQiA9fFwemyOwTSjvld+FYEO+p H5kO2b46o1qer9XeCV6KS5G2CvUxr8Mq2atV1pM9kNFbqwRNwgw6mzqUZt+d9RhwW28E 8O/dTqkhD6gvvdFy9pUfIwQybTzNopDF1h0dUI0EcDXmMDrRFoIH/mtWtE1GSDuz8M1r xtRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=C1t3AHaP6cSe+cH+c+bTuQp0YEJpMrzkSxQbGOquuRU=; b=rclcy7P/NVtSvRKF1ulife9S/Unwt6VA8v+toNI20nBfG5cbZFGNLmXqADPhqueJYN 0lacVRzquz2rf+gp3CaDYJ8qAp1LCSek6x5mC12qFtU/tPewQnDwbzuunnsbDDc+nwqD tkWTXIZXUau+zSz5z0PLBMUDFUfzPds6I0yFMlIcbDv+rdicFDGjrzWvpuk2Ser8Evh9 AbcqzMXsi/t+46fNaSu7FgtC36N/NBMShqskcQdL+Pr1z8lTmlwTLS1WjMZEi6TxNs2L i3GWpeQMAKPba6S9Kt0H4Cn/ZjqZh1UT4AS5sFVbtRPdxJ/cG9g2zsZNqb+4w5+SsjLT XwcQ== X-Gm-Message-State: AOAM532KcJoe8eUSduM9zqZ2H6v6YFG4rytgxW0qfXdI8BXkWb5DDbJ6 XaOmMBmTaJ9h2NucxKKkWaLIAKyC9glpLw== X-Google-Smtp-Source: ABdhPJymcoUJSXd/VAMOoXscZz70mzJpTV1n0Jf48RwteZM1jnZ4IMz3ZGx76PP0qC29xp9udG+B2w== X-Received: by 2002:a05:6214:242f:: with SMTP id gy15mr826052qvb.22.1624467343077; Wed, 23 Jun 2021 09:55:43 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.95]) by smtp.gmail.com with ESMTPSA id h6sm293966qtr.73.2021.06.23.09.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 09:55:42 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 5E4352A0ADA; Wed, 23 Jun 2021 12:55:40 -0400 (-04) Date: Wed, 23 Jun 2021 12:55:40 -0400 From: Alvaro Herrera To: Boris Kolpackov Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Pipeline mode and PQpipelineSync() Message-ID: <202106231655.5tkagqvcxej5@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ub2kcidd5j7isxn3" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --ub2kcidd5j7isxn3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2021-Jun-23, Boris Kolpackov wrote: > I think one change that is definitely needed is to make it clear that > the PQpipelineSync() call is not optional. > > I would also add a note saying that while the server starts processing > the pipeline immediately, it may buffer the results and the only way > to flush them out is to call PQpipelineSync(). Aren't those two things one and the same? I propose the attached. -- Álvaro Herrera Valdivia, Chile "El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens) --ub2kcidd5j7isxn3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Clarify-that-pipeline-sync-is-mandatory.patch" From d9c2b07d7ef8d85ae387fdf6c9a04bf2c712b6fc Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 23 Jun 2021 12:40:15 -0400 Subject: [PATCH] Clarify that pipeline sync is mandatory --- doc/src/sgml/libpq.sgml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 441cc0da3a..0217f8d8c7 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -5103,10 +5103,12 @@ int PQflush(PGconn *conn); The server executes statements, and returns results, in the order the client sends them. The server will begin executing the commands in the pipeline immediately, not waiting for the end of the pipeline. + Do note that results are buffered on the server side; a synchronization + point, establshied with PQpipelineSync, is necessary + in order for all results to be flushed to the client. If any statement encounters an error, the server aborts the current transaction and does not execute any subsequent command in the queue - until the next synchronization point established by - PQpipelineSync; + until the next synchronization point; a PGRES_PIPELINE_ABORTED result is produced for each such command. (This remains true even if the commands in the pipeline would rollback -- 2.20.1 --ub2kcidd5j7isxn3--