Re: No result when selecting attstattarget from pg_attribute - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: No result when selecting attstattarget from pg_attribute
Date
Msg-id c79795a4eef1b7531cdd00b61dc1c4518ddf0506.camel@cybertec.at
Whole thread Raw
In response to No result when selecting attstattarget from pg_attribute  ("William Sescu (Suva)" <william.sescu@suva.ch>)
List pgsql-admin
On Thu, 2019-11-28 at 09:55 +0000, William Sescu (Suva) wrote:
> Now I create the custom statistics, however, attstattarget is still -1
> 
> (klb@[local]:55000)[knowledgebase]> CREATE STATISTICS s1 (dependencies) ON a, b FROM t1;
> CREATE STATISTICS
> 
> (klb@[local]:55000)[knowledgebase]> select attrelid::regclass as name, attname, attstattarget from pg_attribute where
attnamein ('a','b');
 
>  name | attname | attstattarget
> ------+---------+---------------
>  t1   | a       |            -1
>  t1   | b       |            -1
> (2 rows)
> 
> Am I looking at the wrong view? I am planning to do some upgrades to 12.x, and therefore, I created this little test
case
> to make sure that I don't forget to set custom statistics on the new version, if there are any.

"attstattarget" is set to a value different from -1 if you define a special
statistics detail level for the column:

ALTER TABLE t1 ALTER a SET STATISTICS 1000;

It has nothing to do with extended statistics.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-admin by date:

Previous
From: "William Sescu (Suva)"
Date:
Subject: No result when selecting attstattarget from pg_attribute
Next
From: Tom Lane
Date:
Subject: Re: No result when selecting attstattarget from pg_attribute