Re: GUC_REPORT for protocol tunables was: Re: Optimize binary serialization format of arrays with fixed size elements - Mailing list pgsql-hackers

From A.M.
Subject Re: GUC_REPORT for protocol tunables was: Re: Optimize binary serialization format of arrays with fixed size elements
Date
Msg-id D82FF865-F9F7-45BB-9276-C562164F2CD8@themactionfaction.com
Whole thread Raw
In response to Re: GUC_REPORT for protocol tunables was: Re: Optimize binary serialization format of arrays with fixed size elements  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: GUC_REPORT for protocol tunables was: Re: Optimize binary serialization format of arrays with fixed size elements  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
On Jan 23, 2012, at 4:45 PM, Merlin Moncure wrote:

> On Mon, Jan 23, 2012 at 2:00 PM, A.M. <agentm@themactionfaction.com> wrote:
>> One simple way clients could detect the binary encoding at startup would be to pass known test parameters and match
againstthe returned values. If the client cannot match the response, then it should choose the text representation. 
>>
>> Alternatively, the 16-bit int in the Bind and RowDescription messages could be incremented to indicate a new format
andthen clients can specify the highest "version" of the binary format which they support. 
>
> Prefer the version.  But why send this over and over with each bind?
> Wouldn't you negotiate that when connecting? Most likely, optionally,
> doing as much as you can from the server version?  Personally I'm not
> really enthusiastic about a solution that adds a non-avoidable penalty
> to all queries.
>
> Also, a small nit: this problem is not specific to binary formats.
> Text formats can and do change, albeit rarely, with predictable
> headaches for the client.  I see no reason to deal with text/binary
> differently.  The only difference between text/binary wire formats in
> my eyes are that the text formats are documented.
>
> merlin


In terms of backwards compatibility (to support the widest range of clients), wouldn't it make sense to freeze each
formatoption? That way, an updated text version could also assume a new int16 format identifier. The client would
simplypass its preferred format. This could also allow for multiple in-flight formats; for example, if a client
anticipatesa large in-bound bytea column, it could specify format X which indicates the server should use gzip the
resultbefore sending. That same format may not be preferable on a different request. 

Cheers,
M





pgsql-hackers by date:

Previous
From: Marko Kreen
Date:
Subject: Re: Re: Add minor version to v3 protocol to allow changes without breaking backwards compatibility
Next
From: Merlin Moncure
Date:
Subject: Re: JSON for PG 9.2