Re: list of extended statistics on psql - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: list of extended statistics on psql
Date
Msg-id 20200827131504.7srruqyjipyu6tkn@nol
Whole thread Raw
In response to Re: list of extended statistics on psql  (Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>)
Responses Re: list of extended statistics on psql
List 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.



pgsql-hackers by date:

Previous
From: Grigory Smolkin
Date:
Subject: history file on replica and double switchover
Next
From: Ranier Vilela
Date:
Subject: re: Please help for error ( file is required for XML support )