Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inodq-0004Uz-DG for pgsql-general@arkaria.postgresql.org; Sat, 04 Jan 2020 18:59:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1inodo-0003Ne-Gb for pgsql-general@arkaria.postgresql.org; Sat, 04 Jan 2020 18:59:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inodo-0003NX-6P for pgsql-general@lists.postgresql.org; Sat, 04 Jan 2020 18:59:16 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1inodk-0008Kx-Om for pgsql-general@postgresql.org; Sat, 04 Jan 2020 18:59:15 +0000 Received: from [192.168.127.1] (port=53669 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1inodf-0004O4-0u; Sat, 04 Jan 2020 18:59:07 +0000 Received: from localhost ([127.0.0.1]:54670 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1inode-0001gH-SH; Sat, 04 Jan 2020 18:59:06 +0000 From: Andrew Gierth To: Paula Kirsch Cc: pgsql-general@postgresql.org Subject: Re: When should parameters be passed as text v. binary? In-Reply-To: (Paula Kirsch's message of "Sat, 4 Jan 2020 06:54:41 -0500") Message-ID: <87blrjktdo.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) Date: Sat, 04 Jan 2020 18:59:06 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Paula" == Paula Kirsch writes: Paula> I'm just trying to understand the trade-offs between sending Paula> everything always as text, all integer parameters as binary, Paula> floats as binary, etc. For passing data from client to server, there's no particular reason not to use the binary format for any data type that you understand (and where you're passing the data type oid explicitly in the query, rather than just leaving it as unknown). For results, things are harder, because libpq is currently all-or-nothing about result type formats, and if you start using extension types then not all of them even _have_ a binary format. And to decode a binary result you need to know the type, and have code to handle every specific type's binary format. -- Andrew (irc:RhodiumToad)