On Wed, Oct 14, 2026 at 12:03 AM shihao zhong <[email protected]> wrote:
>
> > One alternative could be to use the extra palloc/memcpy only when
> > skip_nulls is true, after fixing uniqueifyJsonbObject to renumber
> > the pairs.
>
> v2 does that, with a narrower test for the copy. Removing null pairs
> from the state is harmless unless unique_keys is also set, since the
> dedup loop skips nulls before it looks for duplicates. So 0001 copies
> the pairs only for jsonb_object_agg_unique_strict.
>
> With your benchmark on a non-assert build, HEAD and v2 both take about
> 10 ms of backend CPU, and v1 takes 5.6 s :( .
>
> > (Independently of all this, the documentation for the json-object
> > aggregates is seriously awful.
>
> 0003 is a try at that. It says which value wins for a repeated key,
> and that null values are dropped first but still count in the unique
> check.

Should this have a PG 19 open item?

- Melanie


Reply via email to