| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Corey Huinker <corey(dot)huinker(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-12 02:51:51 |
| Message-ID: | CACJufxHP+wZ9Th2U9JW27cCq-me222e76pv7vcjqt+oCL03m5Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Nov 11, 2025 at 11:14 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Tue, Nov 11, 2025 at 4:07 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> > I've rebased the full set using the new structure. 0001~0004 are
> > clean. 0005~ need more work and analysis, but that's a start.
hi.
+Datum
+pg_ndistinct_out(PG_FUNCTION_ARGS)
+
+
+ appendStringInfo(&str, "], \"" PG_NDISTINCT_KEY_NDISTINCT "\": %d}",
+ (int) item.ndistinct);
I’m a bit confused about the part above,
item.ndistinct is double type, we just cast it to int type?
after apply 0004, the below in doc/src/sgml/perform.sgml also need to change?
<programlisting>
CREATE STATISTICS stts (dependencies) ON city, zip FROM zipcodes;
ANALYZE zipcodes;
SELECT stxname, stxkeys, stxddependencies
FROM pg_statistic_ext join pg_statistic_ext_data on (oid = stxoid)
WHERE stxname = 'stts';
stxname | stxkeys | stxddependencies
---------+---------+------------------------------------------
stts | 1 5 | {"1 => 5": 1.000000, "5 => 1": 0.423130}
(1 row)
</programlisting>
Do you think it's worth the trouble to have two separate
appendStringInfoChar for ``{}``?
for example in loop ``for (i = 0; i < ndist->nitems; i++)``. we can change to:
appendStringInfoChar(&str, '{');
appendStringInfo(&str, "\"" PG_NDISTINCT_KEY_ATTRIBUTES "\": [%d",
item.attributes[0]);
for (int j = 1; j < item.nattributes; j++)
appendStringInfo(&str, ", %d", item.attributes[j]);
appendStringInfo(&str, "], \"" PG_NDISTINCT_KEY_NDISTINCT "\": %d",
(int) item.ndistinct);
appendStringInfoChar(&str, '}');
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2025-11-12 03:48:43 | Re: display hot standby state in psql prompt |
| Previous Message | Chao Li | 2025-11-12 02:35:26 | Re: Add tests for object size limits of injection points |