Re: Extract numeric filed in JSONB more effectively

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extract numeric filed in JSONB more effectively
Date: 2023-09-15 01:53:20
Message-ID: CAKU4AWrGci1GyJ-WhwwT05+6hEWYuH_jFc8Vc=oNp0OzKCEDDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Is there a reason not to transform the _tz flavors of
>> jsonb_path_query and jsonb_path-query_first?
>>
>
> I misunderstood the _tz flavors return timestamp, after some deep
> reading of these functions, they just work at the comparisons part.
> so I will add them in the following version.
>

_tz favors did return timestamp.. the reason is stated in the commit
messge of patch 2.

try to apply jsonb extraction optimization to _tz functions.

both jsonb_path_query_tz and jsonb_path_query_tz_first returns
the elements which are timestamp comparable, but such elements
are impossible to be cast to numeric or boolean IIUC. Just provides
this commit for communication purpose only.

so v14 is attached, changes include:
1. Change the typmod for internal type from 0 to -1.
2. return NULL for non-simplify expressions from the planner
support function, hence shallow copy is removed as well.

Things are not addressed yet:
1. the error message handling.
2. if we have chances to optimize _tz functions, I guess no.
3. function naming issue. I think I can get it modified once after
all the other issues are addressed.

--
Best Regards
Andy Fan

Attachment Content-Type Size
v14-0002-try-to-apply-jsonb-extraction-optimization-to-_t.patch application/octet-stream 3.9 KB
v14-0001-optimize-casting-jsonb-to-a-given-type.patch application/octet-stream 36.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryoga Yoshida 2023-09-15 02:37:46 Bug fix for psql's meta-command \ev
Previous Message Andres Freund 2023-09-15 01:28:56 Re: Is it possible to change wal_level online