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 1jpC0P-0007i5-F3 for pgsql-general@arkaria.postgresql.org; Sat, 27 Jun 2020 14:40:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jpC0O-0000Sf-4k for pgsql-general@arkaria.postgresql.org; Sat, 27 Jun 2020 14:40:32 +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 1jpC0N-0000RY-Sd for pgsql-general@lists.postgresql.org; Sat, 27 Jun 2020 14:40:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jpC0H-0008Um-FW for pgsql-general@postgresql.org; Sat, 27 Jun 2020 14:40:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05REeM3O070949; Sat, 27 Jun 2020 10:40:22 -0400 From: Tom Lane To: Samuel Williams cc: "David G. Johnston" , pgsql-general Subject: Re: libpq pipelineing In-reply-to: References: Comments: In-reply-to Samuel Williams message dated "Sat, 27 Jun 2020 19:30:51 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <70947.1593268822.1@sss.pgh.pa.us> Date: Sat, 27 Jun 2020 10:40:22 -0400 Message-ID: <70948.1593268822@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Samuel Williams writes: > Here is a short example: > https://gist.github.com/ioquatix/2f08f78699418f65971035785c80cf18 > It makes 10 queries in one "PQsendQuery" and sets single row mode. But > all the results come back at once as shown by the timestamps. That looks to be less about what libpq will do than what the Ruby interface code will do. The volume of return data may also be an issue. I don't think the backend will flush data out to the client except when it (a) reaches an idle state or (b) fills the output buffer. Ten occurrences of a short query result aren't gonna be enough for (b) --- from memory, that buffer is probably 8KB. regards, tom lane