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 1phPmP-0000j4-EO for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Mar 2023 06:59:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phPmN-0005BD-5J for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Mar 2023 06:59:31 +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 1phPmM-0005B3-AF for pgsql-hackers@lists.postgresql.org; Wed, 29 Mar 2023 06:59:30 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phPmJ-0003Rw-AJ for pgsql-hackers@postgresql.org; Wed, 29 Mar 2023 06:59:29 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 18E5F5C007C; Wed, 29 Mar 2023 02:59:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 29 Mar 2023 02:59:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1680073166; x=1680159566; bh=zo UnUaBsBVSMZO+jlhahW7P2nnht2SaS4AqqvenkeFo=; b=gxb391Rpty17ZkHgl2 7I6Duzs1rszAi1HKB9u5jJKUGjC7DDNFDY422N9smGkfC+OQd8F5pmA5nagAOvko 5Hpm647z3lfsT8SYfhx8fKjIwVfZXC1W+8zWKtz8NkPguynVtSOTSxvDmbY/Y5B+ tLv2gMiSFGIhf80vhq4VVWQcf1mk5dWINxbObmhJEHDAHNVar1o//ANw4aePEaON 5UokoIHK5+r/yCYwc6oXuiKnG9fD17KiT+gH2p6rAWAPTKqtJ/EtAQEDuF7Ij80o 79Anowrf0VKDBQtL8WmwxhBjZtVfMxc+J4iM0az1ipJpf8W5B8OvewOYXpVHPUJf mlfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680073166; x=1680159566; bh=zoUnUaBsBVSMZ O+jlhahW7P2nnht2SaS4AqqvenkeFo=; b=E3ZSD6kVvGTQAMZcQlyRFrNniFnEJ J2eKD0x8FSI0l4byrwCn8nGNBe27M69ePeXJ0hhrW7aFWlgPajtQxK4vgbnnifUQ u6mXYnRn4E1ZCUKh3eea6ccn0bhPoR3qtOPr89IrDdgOeNNOuLWLhQheml2CPpId pmGPgj57bbcpEngmlLi+e8OBmvz4tMveI/upBUBaRVEOmkhJN23odnCxsvC8lH98 esliOHpvD9ErB2TOsQ2pz2H33XrGyKxhu7WBExqDRB5EJVAb0loV5aLfGCOoxP1Z o035Q+AOaZ72MnnJs74Z4TarQ1rPmFcbiA/uir0J/vwzM2zkJ58j0xHJw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehhedgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculddvfedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreer tddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlse hprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeegkedtueethedvveeuueej vdeiffduuefgvedtgfefiedtvdetheegteeiheefieenucffohhmrghinhepghhithhhuh gsrdgtohhmpdhpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighi ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Mar 2023 02:59:23 -0400 (EDT) Date: Wed, 29 Mar 2023 15:59:20 +0900 From: Michael Paquier To: "Imseih (AWS), Sami" Cc: "Drouvot, Bertrand" , David Zhang , "pgsql-hackers@postgresql.org" Subject: Re: [BUG] pg_stat_statements and extended query protocol Message-ID: References: <3227719C-F7A3-4A94-B0A5-D27673316560@amazon.com> <0d583e2a-8214-4975-a4b4-7e9e0b8f8e9c@gmail.com> <472cfda7-1e4f-ed47-0860-78cf685b53b0@gmail.com> <8FFCD4F0-8B04-4EA2-9190-FEC70C376523@amazon.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="w01Op4GzcqXdEksg" Content-Disposition: inline In-Reply-To: <8FFCD4F0-8B04-4EA2-9190-FEC70C376523@amazon.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --w01Op4GzcqXdEksg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 23, 2023 at 01:54:05PM +0000, Imseih (AWS), Sami wrote: > Yes, that is possible but we will need to add a libpq API > that allows the caller to pass in a "fetch size". > PQsendQueryParams does not take in a "fetch size",=20 > so it returns all rows, through PQsendQueryParams >=20 > https://github.com/postgres/postgres/blob/master/src/interfaces/libpq/fe-= exec.c#L1882 >=20 > Adding such an API that takes in a "fetch size" will be beneficial=20 > not just for this test, but I can see it enabling another psql meta comma= nd, > similar to \bind but that takes in a "fetch size". So... The idea here is to set a custom fetch size so as the number of calls can be deterministic in the tests, still more than 1 for the tests we'd have. And your point is that libpq enforces always 0 when sending the EXECUTE message causing it to always return all the rows for any caller of PQsendQueryGuts(). The extended protocol allows that, so you would like a libpq API to have more control of what we send with EXECUTE: https://www.postgresql.org/docs/current/protocol-overview.html#PROTOCOL-QUE= RY-CONCEPTS The extended query protocol would require multiple 'E' messages, but we would not need multiple describe or bind messages, meaning that this cannot just be an extra flavor PQsendQueryParams(). Am I gettig that right? The correct API design seems tricky, to say the least. Perhaps requiring this much extra work in libpq for the purpose of having some tests in this thread is not a brilliant idea.. Or perhaps we could just do it and have something a-la-JDBC with two routines? That would be one libpq routine for describe/bind and one for execute where the limit can be given by the caller in the latter case, similar to sendDescribeStatement() and sendExecute() in QueryExecutorImpl.java. -- Michael --w01Op4GzcqXdEksg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQj4cgACgkQnvQgOdby QH33HA//eBeOj3MDCm6P/oJIr4FotfBvQsJtWE9mBbqruUUhlAHRenR6vUidbJhv vTcSnY6Uy0Tgd/njK9/hKff/ULcRGPb60J9/JFe43TtSynZro4u2hONDpUtZhXLU 1OMIIKCey5HLiqlHebc9MmCvzX4zsos9JpIjbN/RH1WCJDB/QGp/KUTQ8AnEgjOT eoDdo4dF/7JzaKrc+CJ4RMkRFzV145KXmyfkX+92M0QArjxrcGwir7yTZ8o0bAbu WmovjwIS/1wVZoyqsqz1hfsD6P35LUkQVh3kIAetHTNsP1lX0ZS0cpbAimJDoXiE 2q8X2MGdKiTsIU1bOKN7xWuSFu+rgG5tJJyDdYSnKdGJlHxRrR50dZdY5K0quu+x y4GGst16n86QqDadRfxN8xaAQaCnMWKwOMa/PL9vHxgES/7KIUVwN4SsjyaSro2L 19jAwmkA5IhRsGROvf4IMtXA/Tgs24iUxxW9X2Y/ZpkxZWSq12NaS98eZO0ETbFy dLogtllSqkyb8h1FAhI9dw+lJGQcHhPnMrG2InXgMdcDMykdM3zZtfCJ0VQgkPgK AfY0SPAusjgK//I/hK32wBYgKNyxXlBRB6DzNYWVuYXB1FYC5jlo5+9gDanGnSAI nHdRu6YQpTDBYMAGC5CIQgRzOG3dDqmufcCTRTrkd39ijBXs10Q= =8kzG -----END PGP SIGNATURE----- --w01Op4GzcqXdEksg--