Re: Extended Statistics set/restore/clear functions.

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Extended Statistics set/restore/clear functions.
Date: 2025-01-29 19:56:33
Message-ID: CADkLM=f0sy9X=Y18UCkOPBX+4NSXKOsuQwPwphPJFNzwM9=_Xw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 28, 2025 at 11:25 AM jian he <jian(dot)universality(at)gmail(dot)com>
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 "postgres.h"
> already included it.
>

Noted.

> select '[{"6, -32768,,": -11}]'::pg_ndistinct;
> ERROR: malformed pg_ndistinct: "[{"6, -32768,,": -11}]"
> LINE 1: select '[{"6, -32768,,": -11}]'::pg_ndistinct;
> ^
> DETAIL: All ndistinct count values are scalar doubles.
> imho, this errdetail message is not good.
>

What error message do you think is appropriate in that situation?

> select '{}'::pg_ndistinct ;
> segfault
>

Mmm, gotta look into that!

>
>
> select '{"1,":"1"}'::pg_ndistinct ;
> ERROR: malformed pg_ndistinct: "{"1,":"1"}"
> LINE 1: select '{"1,":"1"}'::pg_ndistinct ;
> ^
> DETAIL: All ndistinct attnum lists must be a comma separated list of
> attnums.
>
> imho, this errdetail message is not good. would be better saying that
> "length of list of attnums must be larger than 1".
>

That sounds better.

> typcategory (Z) marked as Internal-use types. and there is no
> pg_ndistinct array type,
> not sure this is fine.
>

I think it's probably ok for now. The datatype currently has no utility
other than extended statistics, and I'm doubtful that it ever will.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2025-01-29 20:04:40 Re: Extended Statistics set/restore/clear functions.
Previous Message James Coleman 2025-01-29 19:54:06 Idea: lock_timeout scoped by lock types