Re: No result when selecting attstattarget from pg_attribute

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "William Sescu (Suva)" <william(dot)sescu(at)suva(dot)ch>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: No result when selecting attstattarget from pg_attribute
Date: 2019-11-28 14:23:15
Message-ID: c79795a4eef1b7531cdd00b61dc1c4518ddf0506.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)[local]:55000)[knowledgebase]> CREATE STATISTICS s1 (dependencies) ON a, b FROM t1;
> CREATE STATISTICS
>
> (klb(at)[local]:55000)[knowledgebase]> select attrelid::regclass as name, attname, attstattarget from pg_attribute where attname in ('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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2019-11-28 14:54:14 Re: No result when selecting attstattarget from pg_attribute
Previous Message William Sescu (Suva) 2019-11-28 09:55:10 No result when selecting attstattarget from pg_attribute