From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Ryan Pedela <rpedela(at)datalanche(dot)com>, Sehrope Sarkuni <sehrope(at)jackdb(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add jsonb_compact(...) for whitespace-free jsonb to text |
Date: | 2016-04-27 12:50:53 |
Message-ID: | CAHyXU0zrEC2pqmGOo2cE+6i8mqdEarC52d+dqcr9yZSmwGOicQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Apr 26, 2016 at 11:49 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Ryan Pedela (rpedela(at)datalanche(dot)com) wrote:
>> On Sun, Apr 24, 2016 at 4:02 PM, Sehrope Sarkuni <sehrope(at)jackdb(dot)com> wrote:
>> > The default text representation of jsonb adds whitespace in between
>> > key/value pairs (after the colon ":") and after successive properties
>> > (after the comma ","):
>
> [...]
>
>> > It'd be nice to have a stable text representation of a jsonb value with
>> > minimal whitespace. The latter would also save a few bytes per record in
>> > text output formats, on the wire, and in backups (ex: COPY ... TO STDOUT).
>>
>> +1
>>
>> I cannot comment on the patch itself, but I welcome jsonb_compact() or some
>> way to get JSON with no inserted whitespace.
>
> As I mentioned to Sehrope on IRC, at least for my 2c, if you want a
> compact JSON format to reduce the amount of traffic over the wire or to
> do things with on the client side, we should probably come up with a
> binary format, rather than just hack out the whitespace. It's not like
> representing numbers using ASCII characters is terribly efficient
> either.
-1
This will benefit pretty much nobody unless you are writing a hand
crafted C application that consumes and processes the data directly.
I'd venture to guess this is a tiny fraction of pg users these days.
I do not understand at all the objection to removing whitespace.
Extra whitespace does nothing but pad the document as humans will
always run the document through a prettifier tuned to their specific
requirements (generally starting with, intelligent placement of
newlines) if reading directly.
Also, binary formats are not always smaller than text formats.
> Compression might be another option, though that's certainly less
> flexible and only (easily) used in combination with SSL, today.
right, exactly.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-04-27 13:44:26 | Re: 9.6 and fsync=off |
Previous Message | Dave Cramer | 2016-04-27 12:36:30 | Re: Add jsonb_compact(...) for whitespace-free jsonb to text |