Re: WIP Patch: Add a function that returns binary JSONB as a bytea - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: WIP Patch: Add a function that returns binary JSONB as a bytea
Date
Msg-id c7b43b51-e21e-8b69-751c-c87314ed34fc@2ndquadrant.com
Whole thread Raw
In response to Re: WIP Patch: Add a function that returns binary JSONB as a bytea  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On 11/02/2018 01:42 PM, Daniel Gustafsson wrote:
>> On 2 Nov 2018, at 04:21, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
>> (In short, I remain unconvinced that we'd not be better off spending
>> our effort on making json_out faster...)
> 
> Shooting wildly from the hip, isn't this a case where we can
> potentially utilize the JIT infrastructure to speed it up?
> 

I don't see how could it help here. The crucial idea of JIT is that if
you postpone the compilation, you may provide additional information
that may allow eliminating parts of the code.

For example, we don't know anything about table structure in general, so
the tuple deforming code had to assume any attribute may be NULL etc.
making the code rather complex with many branches, loops etc. But at
runtime we have the tuple descriptor, so with JIT we may eliminate some
of the branches.

But we don't have anything like that for jsonb - every value may be an
arbitrary json document, etc. And each value (even if stored in the same
column) may be entirely different.

Maybe it's just lack of imagination on my side, but I don't see how
could this benefit from JIT :-(

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: COPY FROM WHEN condition
Next
From: Robert Haas
Date:
Subject: Re: WIP: Avoid creation of the free space map for small tables