From: Laurenz Albe <laurenz.albe@cybertec.at>
To: William Sescu (Suva) <william.sescu@suva.ch>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: AW: No result when selecting attstattarget from pg_attribute
Date: Thu, 28 Nov 2019 16:23:33 +0100
Message-ID: <cb254ce872c8e01d42a54ef2dcb2f4c90459c679.camel@cybertec.at> (raw)
In-Reply-To: <9545ee300c12457f8ef09c8708d45f31@suva.ch>
References: <4078c426dbbb4e18a047ec00485adba9@suva.ch>
<31263.1574952854@sss.pgh.pa.us>
<9545ee300c12457f8ef09c8708d45f31@suva.ch>
On Thu, 2019-11-28 at 15:14 +0000, William Sescu (Suva) wrote:
> Thank you Tom for clarification. However, in regards of pg_upgrade, which does not transfer statistics, how do I know
> how to create the "CREATE STATISTICS" on the new PostgreSQL version?
>
> e.g. Developers created a whole bunch of "CREATE STATISTICS" on all kind of tables, which ends up in pg_statistic_ext view.
>
> select * from pg_statistic_ext;
> stxrelid | stxname | stxnamespace | stxowner | stxkeys | stxkind | stxndistinct | stxdependencies
> ----------+---------+--------------+----------+---------+---------+--------------+----------------------
> 35600 | s1 | 16579 | 16569 | 1 2 | {f} | | {"1 => 2": 1.000000}
>
> Is there any way how I can translate the view entries into into a SQL again?
>
> CREATE STATISTICS s1 (dependencies) ON a, b FROM t1;
You are worrying without need.
While the actual statistics won't be upgraded, the *definition* for
extended statistics will be. So your CREATE STATISTICS won't vanish
during an upgrade.
You'll have to ANALYZE after upgrading so that PostgreSQL collects the
extended statistics.
Extended statistics are stored in the "pg_statistic_ext" catalog.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: laurenz.albe@cybertec.at, william.sescu@suva.ch, tgl@sss.pgh.pa.us
Subject: Re: AW: No result when selecting attstattarget from pg_attribute
In-Reply-To: <cb254ce872c8e01d42a54ef2dcb2f4c90459c679.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox