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 1kVsvK-0004f9-Ez for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Oct 2020 08:59:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kVsvJ-0001oJ-D2 for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Oct 2020 08:59:45 +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 1kVsvI-0001oB-Il for pgsql-hackers@lists.postgresql.org; Fri, 23 Oct 2020 08:59:45 +0000 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVsvF-0003xF-L4 for pgsql-hackers@postgresql.org; Fri, 23 Oct 2020 08:59:43 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 7942C1940D73; Fri, 23 Oct 2020 04:59:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 23 Oct 2020 04:59:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=lRg51lkgrBjoM26S9pfA0xXuyBGGmvHKQgJy9nTmS 5c=; b=bapVS7VHo7SXma0HV+9viKxYw4GkGLTWHwZsq36Vxv68fBVeudaIUoLSU NwiAIBtJQWJdH/Y1oAXZ6KsL0P8apyNOan/q7HxBxZxsO8JCmXJoyqYL5VUcY868 v5ZDvn3CX1XPREqdW+asHmAv2nEE7cQWX1Fr9DvLHxvvDhuWolndJdq3DAPExKaE HxuIxbHe/XFurm5sM6HubE50i85QZlKotHTf49uqThwphtyDT5y9WPl9JAR6eovr fAnMaxCgebjlEywu9d6Y3wWBAk0P8fCRGPV7FzuFJzfyg3nv+DscnPZfs11DQOpV +qiwmgWSHQRkQwX4CWnb6UdrDVtOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkedtgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhfhokffffgggjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeelffffteffjeefhfehffev keeiteeikedufeffhfehveeilefhtefhgeefudehtdenucffohhmrghinhepvdhnughquh grughrrghnthdrtghomhenucfkphepkeejrddujeejrdejuddrvddvjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p57b147e3.dip0.t-ipconnect.de [87.177.71.227]) by mail.messagingengine.com (Postfix) with ESMTPA id 0F8473064682; Fri, 23 Oct 2020 04:59:38 -0400 (EDT) Subject: Re: dynamic result sets support in extended query protocol To: Dave Cramer References: <6e747f98-835f-2e05-cde5-86ee444a7140@2ndquadrant.com> <20201009184625.4hfgpcxzd6jfredb@alap3.anarazel.de> <20201009185902.2hrednanwa7dxout@alap3.anarazel.de> <26d034cc-d4af-e2f8-72b8-f23fea9320ed@2ndquadrant.com> Cc: Andres Freund , pgsql-hackers , Vladimir Sitnikov , Shay Rojansky , Mark Paluch From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <160f6d3e-466f-f75c-db41-e44355de29e8@2ndquadrant.com> Date: Fri, 23 Oct 2020 10:59:38 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-10-20 12:24, Dave Cramer wrote: > Finally, we could do it an a best-effort basis.  We use binary format > for registered types, until there is some invalidation event for the > type, at which point we revert to default/text format until the end > of a > session (or until another protocol message arrives re-registering the > type). > > Does the driver tell the server what registered types it wants in binary ? Yes, the driver tells the server, "whenever you send these types, send them in binary" (all other types keep sending in text). > This should work, because the result row descriptor contains the > actual format type, and there is no guarantee that it's the same one > that was requested. > > So how about that last option?  I imagine a new protocol message, say, > TypeFormats, that contains a number of type/format pairs.  The message > would typically be sent right after the first ReadyForQuery, gets no > response. > > This seems a bit hard to control. How long do you wait for no response? In this design, you don't need a response. > It could also be sent at any other time, but I expect that to > be less used in practice.  Binary format is used for registered > types if > they have binary format support functions, otherwise text continues to > be used.  There is no error response for types without binary support. > (There should probably be an error response for registering a type that > does not exist.) > > I'm not sure we (pgjdbc) want all types with binary support functions > sent automatically. Turns out that decoding binary is sometimes slower > than decoding the text and the on wire overhead isn't significant. > Timestamps/dates with timezone are also interesting as the binary output > does not include the timezone. In this design, you pick the types you want. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services