Re: JSON output from psql - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: JSON output from psql
Date
Msg-id 5EBC601E.3020704@anastigmatix.net
Whole thread Raw
In response to Re: JSON output from psql  (Gurjeet Singh <gurjeet@singh.im>)
Responses Re: JSON output from psql
List pgsql-hackers
On 05/13/20 16:16, Gurjeet Singh wrote:
> On Wed, May 13, 2020 at 1:14 PM Gurjeet Singh <gurjeet@singh.im> wrote:
>>
>> Arguably, delivering JSON (with its repeating attribute names in every
>> element of the array, dquotes and commas) is more network intensive
>> than converting the resultset to JSON on [client] side.

Does this suggest perhaps some sort of hybrid approach, where jsonbc
could be available as a binary on-the-wire format and the client only
needs the ability to deparse it: a query on the server could marshal
the results into that form, the client negotiates the binary transfer
format, and deparses to normal JSON syntax on its end?

It seems the server-side "compression" to jsonbc should be optimizable
when what is happening is marshaling of a tabular result: what the
repeating keys are going to be is known up front.

Maybe could use a transient (or session lifetime?) 'external' dictionary
that gets generated and sent to the client. but not stored in
pg_jsonb_dict?

Seems like a lot of work just to get json-shaped query results from psql,
but maybe the ability to receive jsonbc on the wire would be of interest
to drivers generally.

Regards,
-Chap



pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: COPY, lock release and MVCC
Next
From: Chapman Flack
Date:
Subject: document? Re: Do I understand commit timestamps correctly?