Re: list of extended statistics on psql

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: list of extended statistics on psql
Date: 2020-08-27 13:15:04
Message-ID: 20200827131504.7srruqyjipyu6tkn@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Yamada-san,

On Thu, Aug 27, 2020 at 03:13:09PM +0900, Tatsuro Yamada wrote:
>
> I re-read a help message of \d* commands and realized it's better to
> use "\dX".
> There are already cases where the commands differ due to differences
> in case, so I did the same way. Please find attached patch. :-D
> For example:
> ==========
> \da[S] [PATTERN] list aggregates
> \dA[+] [PATTERN] list access methods
> ==========
>
> Attached patch uses "\dX" instead of "\dz":
> ==========
> \dx[+] [PATTERN] list extensions
> \dX [PATTERN] list extended statistics
> ==========

Thanks for updating the patch! This alias will probably be easier to remember.

>
> Results of regress test of the feature are the following:
> ==========
> -- check printing info about extended statistics
> create table t1 (a int, b int);
> create statistics stts_1 (dependencies) on a, b from t1;
> create statistics stts_2 (dependencies, ndistinct) on a, b from t1;
> create statistics stts_3 (dependencies, ndistinct, mcv) on a, b from t1;
> create table t2 (a int, b int, c int);
> create statistics stts_4 on b, c from t2;
> create table hoge (col1 int, col2 int, col3 int);
> create statistics stts_hoge on col1, col2, col3 from hoge;
>
> \dX
> List of extended statistics
> Schema | Table | Name | Columns | Ndistinct | Dependencies | MCV
> --------+-------+-----------+------------------+-----------+--------------+-----
> public | hoge | stts_hoge | col1, col2, col3 | t | t | t
> public | t1 | stts_1 | a, b | f | t | f
> public | t1 | stts_2 | a, b | t | t | f
> public | t1 | stts_3 | a, b | t | t | t
> public | t2 | stts_4 | b, c | t | t | t
> (5 rows)
>
> \dX stts_?
> List of extended statistics
> Schema | Table | Name | Columns | Ndistinct | Dependencies | MCV
> --------+-------+--------+---------+-----------+--------------+-----
> public | t1 | stts_1 | a, b | f | t | f
> public | t1 | stts_2 | a, b | t | t | f
> public | t1 | stts_3 | a, b | t | t | t
> public | t2 | stts_4 | b, c | t | t | t
> (4 rows)
>
> \dX *hoge
> List of extended statistics
> Schema | Table | Name | Columns | Ndistinct | Dependencies | MCV
> --------+-------+-----------+------------------+-----------+--------------+-----
> public | hoge | stts_hoge | col1, col2, col3 | t | t | t
> (1 row)
> ==========

Thanks also for the documentation and regression tests. This overall looks
good, I just have a two comments:

- there's a whitespace issue in the documentation part:

add_list_extended_stats_for_psql_by_dX_command.patch:10: tab in indent.
<varlistentry>
warning: 1 line adds whitespace errors.

- You're sorting the output on schema, table, extended statistics and columns
but I think the last one isn't required since extended statistics names are
unique.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-08-27 13:16:22 re: Please help for error ( file <libxml/parser.h> is required for XML support )
Previous Message Grigory Smolkin 2020-08-27 13:02:44 history file on replica and double switchover