From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Mitar <mmitar(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Why is writing JSONB faster than just JSON? |
Date: | 2021-04-15 19:11:40 |
Message-ID: | 20210415191140.pu4jukp6245wkzit@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On Thu, Apr 15, 2021 at 12:47:25PM -0400, Tom Lane wrote:
> Dmitry Dolgov <9erthalion6(at)gmail(dot)com> writes:
> > On Wed, Apr 14, 2021 at 10:26:23AM -0400, Tom Lane wrote:
> >> My own guess about this, without having tried to reproduce it, is that
> >> JSONB might end up physically smaller than JSON, resulting in less work
> >> to push the toasted datum out to disk. This'd depend a lot on your
> >> formatting habits for JSON, of course. But in any case, it'd be worth
> >> comparing pg_column_size() results to see what's up with that.
>
> > Oh, of course I've missed that the input I was using was indeed
> > formatted, without formatting both cases perform equally well and I
> > can't reproduce the issue. Although if I understand correctly the
> > original code in question doesn't actually do any formatting.
>
> My point was that for JSON, after validating that the input is
> syntactically correct, we just store it as-received. So in particular
> the amount of whitespace in the value would depend on how the client
> had chosen to format the JSON. This'd affect the stored size of
> course, and I think it would have an effect on compression time too.
Yes, I got it and just wanted to confirm you were right - this was the
reason I've observed slowdown trying to reproduce the report.
From | Date | Subject | |
---|---|---|---|
Next Message | obi reddy | 2021-04-15 21:00:23 | Re: Pg_upgrade problem. |
Previous Message | Adrian Klaver | 2021-04-15 17:52:45 | Re: Pg_upgrade problem. |