Re: list of extended statistics on psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: list of extended statistics on psql
Date: 2020-08-24 04:12:42
Message-ID: CAFj8pRAvskp42=BY=aD2TZsEDX14Chq_L05n8stSN-kL1n+frw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

po 24. 8. 2020 v 5:23 odesílatel Tatsuro Yamada <
tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp> napsal:

> Hi!
>
> I created a POC patch that allows showing a list of extended statistics by
> "\dz" command on psql. I believe this feature helps DBA and users who
> would like to know all extended statistics easily. :-D
>
> I have not a strong opinion to assign "\dz". I prefer "\dx" or "\de*"
> than "\dz" but they were already assigned. Therefore I used "\dz"
> instead of them.
>
> Please find the attached patch.
> Any comments are welcome!
>
> For Example:
> =======================
> CREATE TABLE t1 (a INT, b INT);
> CREATE STATISTICS stts1 (dependencies) ON a, b FROM t1;
> CREATE STATISTICS stts2 (dependencies, ndistinct) ON a, b FROM t1;
> CREATE STATISTICS stts3 (dependencies, ndistinct, mcv) ON a, b FROM t1;
> ANALYZE t1;
>
> CREATE TABLE t2 (a INT, b INT, c INT);
> CREATE STATISTICS stts4 ON b, c FROM t2;
> ANALYZE t2;
>
> postgres=# \dz
> List of extended statistics
> Schema | Table | Name | Columns | Ndistinct | Dependencies | MCV
> --------+-------+-------+---------+-----------+--------------+-----
> public | t1 | stts1 | a, b | f | t | f
> public | t1 | stts2 | a, b | t | t | f
> public | t1 | stts3 | a, b | t | t | t
> public | t2 | stts4 | b, c | t | t | t
> (4 rows)
>
> postgres=# \?
> ...
> \dy [PATTERN] list event triggers
> \dz [PATTERN] list extended statistics
> \l[+] [PATTERN] list databases
> ...
> =======================
>
> For now, I haven't written a document and regression test for that.
> I'll create it later.
>

+1 good idea

Pavel

> Thanks,
> Tatsuro Yamada
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-08-24 04:13:39 Re: Creating a function for exposing memory usage of backend process
Previous Message torikoshia 2020-08-24 04:01:42 Re: Creating a function for exposing memory usage of backend process