Re: Extended Statistics set/restore/clear functions.

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: Extended Statistics set/restore/clear functions.
Date: 2025-11-18 08:52:31
Message-ID: CADkLM=czQ0UUyBn3AiHZfJJWRwXH5e2xn056yG0mpuXpW09RSw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > SELECT '[{"attributes" : [2,3], "ndistinct" : 4, "ndistinct" :
> > 14}]'::pg_ndistinct;
> > pg_ndistinct
> > -------------------------------------------
> > [{"attributes": [2, 3], "ndistinct": 14}]
> >
> > SELECT '[{"attributes" : [2,3], "ndistinct" : 4, "attributes" :
> > []}]'::pg_ndistinct;
> > pg_ndistinct
> > ------------------------------------------
> > [{"attributes": [2, 3], "ndistinct": 4}]
> >
> > Is the above output what we expected?
>
> Interesting one. The extra "attributes" should not be required once
> we have one set, indeed.
> --
> Michael
>

v15:

- catches duplicate object keys cited above
- enforces attnum ordering (ascending positive numbers followed by
descending negative numbers, no zeros allowed), which means we get
duplicate attnum detection for free
- attnum validation is now done as soon as the attnum is parsed
- tests refactored to put attnums in proper order
- unfortunately, this means that one of the error cases from
stats_import.sql (attnum = 0) is now an error rather than something that
can be soft-excluded.
- didn't enforce combinatorical completeness for dependencies because not
all combinations are guaranteed to be there.
- didn't enforce combinatorical completeness for ndistinct because I'm not
convinced we should.

Attachment Content-Type Size
v15-0001-Add-working-input-function-for-pg_ndistinct.patch text/x-patch 53.6 KB
v15-0002-Add-working-input-function-for-pg_dependencies.patch text/x-patch 39.4 KB
v15-0003-Expose-attribute-statistics-functions-for-use-in.patch text/x-patch 10.7 KB
v15-0004-Add-extended-statistics-support-functions.patch text/x-patch 166.8 KB
v15-0005-Include-Extended-Statistics-in-pg_dump.patch text/x-patch 13.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Viktor Holmberg 2025-11-18 08:55:31 Re: Running a single test
Previous Message Peter Eisentraut 2025-11-18 08:50:37 GUC thread-safety approaches