Re: Making jsonb_agg() faster

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Making jsonb_agg() faster
Date: 2025-11-20 18:56:37
Message-ID: 2052300.1763664997@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> writes:
>> You left two “ugly hack” comments. Maybe add a short description for why they are hack and what can be improved in the future.

> It's the same ugly hack as before, I just formatted the code more
> legibly ... I didn't stop to look at whether there's a better way to
> do it. Again, that seems like material for a different patch.

I took another look at that code and decided that it wasn't quite
as bad a hack as I first thought: it's relying on the upcoming
JsonbValueToJsonb call to wrap the scalar value into the right
array structure for a "raw scalar" JSONB. Improving the comments
about what this code is doing is definitely within the charter of
my 0001 patch, so here's a new version that improves those two
comments. Otherwise this is the same as v3.

regards, tom lane

Attachment Content-Type Size
v4-0001-Revise-APIs-for-pushJsonbValue-and-associated-rou.patch text/x-diff 73.5 KB
v4-0002-Remove-fundamentally-redundant-processing-in-json.patch text/x-diff 14.2 KB
v4-0003-Micro-optimize-datatype-conversions-in-datum_to_j.patch text/x-diff 6.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2025-11-20 19:08:57 Re: Buffer locking is special (hints, checksums, AIO writes)
Previous Message Robert Haas 2025-11-20 18:35:52 Re: another autovacuum scheduling thread