pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Paula Kirsch <pl.kirsch@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: When should parameters be passed as text v. binary?
Date: Sat, 04 Jan 2020 18:59:06 +0000
Message-ID: <87blrjktdo.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAHaXFPJNy_g5srOJpqAf3Td+71zDoPTfBP+45p58qJdbjsJKaw@mail.gmail.com>
References: <CAHaXFPJNy_g5srOJpqAf3Td+71zDoPTfBP+45p58qJdbjsJKaw@mail.gmail.com>

>>>>> "Paula" == Paula Kirsch <pl.kirsch@gmail.com> 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)





view thread (7+ messages)  latest in thread

Message-ID: <87blrjktdo.fsf@news-spur.riddles.org.uk>
Permalink:  ../87blrjktdo.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87blrjktdo.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, pl.kirsch@gmail.com
  Subject: Re: When should parameters be passed as text v. binary?
  In-Reply-To: <87blrjktdo.fsf@news-spur.riddles.org.uk>
  References: <CAHaXFPJNy_g5srOJpqAf3Td+71zDoPTfBP+45p58qJdbjsJKaw@mail.gmail.com> <87blrjktdo.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox