Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tLWWX-00FKqB-8e for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Dec 2024 23:53:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tLWWU-003yqd-Rc for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Dec 2024 23:53:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tLWWU-003yqU-Gx for pgsql-hackers@lists.postgresql.org; Wed, 11 Dec 2024 23:53:43 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tLWWS-002Mdv-N9 for pgsql-hackers@postgresql.org; Wed, 11 Dec 2024 23:53:43 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-3003e203acaso43548081fa.1 for ; Wed, 11 Dec 2024 15:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeltef.nl; s=google; t=1733961219; x=1734566019; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b+ib1K8OAHXmsEv6TZuBXcxLnXTSs7vcxTeRQJArIH8=; b=WczTOn5/Bb6ODWM5Kg7kA0jaCThXWbLASRhypUd5CEcKv9rpyBOhYYnwS57IFFlNnY lL03TNAybyR0Tkv8gKoLELXj4tD/Vgp3havGydzwVpAJZOtkzM2uMW+cDE6IMVl/w51G KqadHXc4GZgCvGmAF0MSH+OppVr256fZSmfsvHWG0EegXcVNMLs+rFcLWqHEKl+HJC9r VkuDYAoQCJOgrIgUYy9+I0G3AeGsj3zj8+nTSrcPCLcvLJ172fpjTkj7n/UgmVuSTUf2 W0m3SqB6gX1JA6xtgVwq0b9vTRtPttJB9Ou+IUT6pJaAivkrTF/Ogqa3fvUVp63KPbU7 3XhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733961219; x=1734566019; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b+ib1K8OAHXmsEv6TZuBXcxLnXTSs7vcxTeRQJArIH8=; b=qxoVMN8A4l7/r2vfX1OPyv11jlZFgI+9GCfTiwAcZd2n5WFlb99EE/bSJD2ugDXui3 B0v286RaHW8lTHfXl1s0OYR4VVBZiPGN2wLdq6XViTH2deMgUO66t3rKN5LyYL+jNqNV JS249iJ8MDZv6SNZGzLLEsP2YBLsCrZxk2zdEvvrmup7qT8mPvby4ASuPIU1b4NcVtlU Xji7VsJF1HsgJKrK0Asfj013oHvdVxnzmvSCanLZNRz675JmNvFd4p8fMZOKlUlMYvPU pU1ARYjbJXCJkFwQwa5w8+nGwqzdahhvuehwo4xVNpnF0XRgy0uPIoTu77qGnkxx7Zg8 5TDg== X-Forwarded-Encrypted: i=1; AJvYcCUjYqO6O0GX05pNDpM9CvLzbXXO4VZpp4+4vvNuiA/TOyhyyC7//S6NR5OEIGXemlya0pSu8zP+xrptvat/@postgresql.org X-Gm-Message-State: AOJu0Yy/CUUnCqYbq2tm2sBESSwa4FGKGCTeq0YuOwhkPBRmp5c4Earw 3VcVeq1649B/Y98A2QGFSwmmke870gk4yfsF9DL84nBu91DVUZmAhTUo8Y1+NhKlsIH+WYYuHop NDz7jKvy/e57lbbJr/01saE37e6yKvY6+v0Aghw== X-Gm-Gg: ASbGnct/ngDcafYj6YMFn/IjQdlaxytMW9+ctMFNaLH46YAplUVueXRCJdx5a/OPrgY xs4Q09i1b3/izYPGYytZchqyM/68Fxz+AL0agqoOI+VvaJSAltLDx8tduC89RqaZ8H1EW X-Google-Smtp-Source: AGHT+IHfEMYObgM6z6LtCxcL1JZAblTmda4sKhGZ7/8n3nT1TzHXCIP4Yp5TXTAEzerYJywDDl2jrxGTqTCbDHjkYGY= X-Received: by 2002:a05:651c:905:b0:300:2848:fc7f with SMTP id 38308e7fff4ca-30249e82599mr4195761fa.25.1733961219178; Wed, 11 Dec 2024 15:53:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jelte Fennema-Nio Date: Thu, 12 Dec 2024 00:53:27 +0100 Message-ID: Subject: Re: Add Pipelining support in psql To: Anthonin Bonnefoy Cc: Michael Paquier , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 10 Dec 2024 at 11:44, Anthonin Bonnefoy wrote: > num_queries (2nd element in the pipeline status prompt) is now used to > track queued queries that were not flushed (with a flush request or > sync) to the server. It used to count both unflushed queries and > flushed queries. I skimmed the code a bit, but haven't looked closely at it yet. I did try the patch out though. My thoughts below: I think that new prompt is super useful, so useful in fact that I'd suggest linking to it from the \startpipeline docs. I do think that the wording in the docs could be a bit more precise: 1. The columns are not necessarily queries, they are messages or commands. i.e. \parse and \bind_named both count as 1, even though they form one query together. 2. messages not followed by \sync and \flushrequest, could very well already "be sent to the server" (if the client buffer got full, or in case of manual \flush). The main thing that \sync and \flushrequest do is make sure that the server actually sends its own result back, even if its buffer is not full yet. The main feedback I have after playing around with this version is that I'd like to have a \getresult (without the s), to only get a single result. So that you can get results one by one, possibly interleaved with some other queries again. One thing I'm wondering is how useful the num_syncs count is in the pipeline prompt, since you never really wait for a sync. Regarding the usefulness of \flush. I agree it's not as useful as I thought, because indeed \getresults already flushes everything. But it's not completely useless either. The main way I was able to use it interactively in a somewhat interesting way was to send it after a long running query, and then while that's processing type up the next query after it. Something like the following: localhost jelte@postgres:5432-26274=3D #> \startpipeline Time: 0.000 ms localhost jelte@postgres:5432-26274=3D #|0,0,0|> select pg_sleep(5) \bind \g Time: 0.000 ms localhost jelte@postgres:5432-26274=3D #|0,1,0|*> \flush Time: 0.000 ms localhost jelte@postgres:5432-26274=3D #|0,1,0|*> select 1 \bind \g Time: 0.000 ms localhost jelte@postgres:5432-26274=3D #|0,2,0|*> \syncpipeline Time: 0.000 ms localhost jelte@postgres:5432-26274=3D #|1,0,2|*> \getresults pg_sleep =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80 (1 row) ?column? =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80 1 (1 row) Time: 0.348 ms