Re: Extract numeric [field] 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 [field] in JSONB more effectively
Date: 2023-08-10 08:03:15
Message-ID: CAKU4AWpVbUSgq74ACqprLL+tF+UqOU19F59k-9ZX8rSBcH=sxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chap:

Thanks for the review.

> The minor spelling point, the word 'field' has been spelled
> 'filed' throughout this comment (just as in the email subject):
>
> + /*
> + * Simplify cast(jsonb_object_filed(jsonb, filedName) as
> type)
> + * to jsonb_object_field_type(jsonb, filedName,
> targetTypeOid);
> + */
>
>
Thanks for catching this, fixed in v5.

> The question: the simplification is currently being applied
> when the underlying operation uses F_JSONB_OBJECT_FIELD.
> Are there opportunities for a similar benefit if applied
> over F_JSONB_ARRAY_ELEMENT and/or F_JSONB_EXTRACT_PATH?
>

Yes, we do have similar opportunities for both functions. v5 attached for
this.

--
Best Regards
Andy Fan

Attachment Content-Type Size
v5-0001-optimize-casting-jsonb-to-a-given-type.patch application/octet-stream 28.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2023-08-10 08:06:59 Re: Fix last unitialized memory warning
Previous Message Laetitia Avrot 2023-08-10 07:44:28 Re: Adding a pg_servername() function