Re: Extended Statistics set/restore/clear functions.

2025-01-29 Thread Corey Huinker
On Wed, Jan 29, 2025 at 2:50 AM jian he wrote: > hi. > > select '{"1, 0B100101":"NaN"}'::pg_ndistinct; > pg_ndistinct > > {"1, 37": -2147483648} > (1 row) > I think my initial reaction is to just refuse those special values, but I'll look into the parsing code to

Re: Extended Statistics set/restore/clear functions.

2025-01-29 Thread Corey Huinker
On Tue, Jan 28, 2025 at 11:25 AM jian he wrote: > hi. > I reviewed 0001 only. > > in src/backend/statistics/mvdistinct.c > > no need #include "nodes/pg_list.h" since > src/include/statistics/statistics.h sub level include "nodes/pg_list.h" > > no need #include "utils/palloc.h" > sicne #include "p

Re: Extended Statistics set/restore/clear functions.

2025-01-28 Thread jian he
hi. select '{"1, 0B100101":"NaN"}'::pg_ndistinct; pg_ndistinct {"1, 37": -2147483648} (1 row) this is not what we expected? For the VALUE part of pg_ndistinct, float8 has 3 special values: inf, -inf, NaN. For the key part of pg_ndistinct, see example. select '{"1,

Re: Extended Statistics set/restore/clear functions.

2025-01-28 Thread jian he
hi. I reviewed 0001 only. in src/backend/statistics/mvdistinct.c no need #include "nodes/pg_list.h" since src/include/statistics/statistics.h sub level include "nodes/pg_list.h" no need #include "utils/palloc.h" sicne #include "postgres.h" already included it. select '[{"6, -32768,,": -11}]':

Re: Extended Statistics set/restore/clear functions.

2025-01-27 Thread Corey Huinker
> > I'd like to merge these down to 3 patches again, but I'm keeping them > separate for this patchset to isolate the attnum-checking code for this > go-round. > These are mock-ups of the to/from JSON functions, but building from/to text rather than the not-yet-committed pg_ndistinct and pg_depend

Re: Extended Statistics set/restore/clear functions.

2025-01-23 Thread Corey Huinker
> > I see there's a couple MCV-specific functions in the extended_stats.c. >> Shouldn't those go into mvc.c instead? >> > > I wanted to put it there, but there was a reason I didn't and I've now > forgotten what it was. I'll make an effort to relocate it to mcv.c. > Looking at it now, I see that c

Re: Extended Statistics set/restore/clear functions.

2025-01-23 Thread Corey Huinker
> > > > > * no negative attnums in key list > Disregard this suggestion - negative attnums mean the Nth expression in the extended stats object, though it boggles the mind how we could have 222 expressions... > > * no duplicate attnums in key list > This one is still live, am considering. At

Re: Extended Statistics set/restore/clear functions.

2025-01-23 Thread Tomas Vondra
On 1/23/25 15:51, Corey Huinker wrote: > On Wed, Jan 22, 2025 at 5:50 PM Tomas Vondra > wrote: > > Hi, > > Thanks for continuing to work on this. > > On 1/22/25 19:17, Corey Huinker wrote: > > This is a separate thread for work started in [1] but focus

Re: Extended Statistics set/restore/clear functions.

2025-01-23 Thread Corey Huinker
On Wed, Jan 22, 2025 at 5:50 PM Tomas Vondra wrote: > Hi, > > Thanks for continuing to work on this. > > On 1/22/25 19:17, Corey Huinker wrote: > > This is a separate thread for work started in [1] but focused purely on > > getting the following functions working: > > > > * pg_set_extended_stats

Re: Extended Statistics set/restore/clear functions.

2025-01-22 Thread Tomas Vondra
Hi, Thanks for continuing to work on this. On 1/22/25 19:17, Corey Huinker wrote: > This is a separate thread for work started in [1] but focused purely on > getting the following functions working: > > * pg_set_extended_stats > * pg_clear_extended_stats > * pg_restore_extended_stats > > These