Re: Why is writing JSONB faster than just JSON?

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Mitar <mmitar(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why is writing JSONB faster than just JSON?
Date: 2021-05-02 12:50:47
Message-ID: 20210502125047.vzsksguxxzv34vio@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Fri, Apr 23, 2021 at 01:56:57AM -0700, Mitar wrote:
> Hi!
>
> On Thu, Apr 15, 2021 at 12:11 PM Dmitry Dolgov <9erthalion6(at)gmail(dot)com> wrote:
> > > 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.
>
> Thank you for trying to reproduce the report. I did a bit more digging
> myself and I am still confused.
>
> ...
>
> So I do not know what is happening and why you cannot reproduce it.

Could you maybe get a profile with perf for both cases? Since they're
executed within a single backend, you can profile only a single pid.
Having a reasonable profiling frequency, --call-graph dwarf and probably
limit events to only user space with precise tagging (cycles:uppp)
should give an impression what's going on.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pól Ua Laoínecháin 2021-05-02 13:46:41 PostgreSQL, Asynchronous I/O, Buffered I/O and why did fsync-gate not affect Oracle or MySQL?
Previous Message Pedro Luis Guzmán Hernández 2021-05-02 04:52:56 Extended stats - value not in MCV list