Re: Forcing analyze on DB after upgrading?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Forcing analyze on DB after upgrading?
Date: 2019-10-30 05:38:38
Message-ID: 7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, 2019-10-29 at 22:11 -0700, Wells Oliver wrote:
> I just upgraded from 9.6 to 12, and am noticing some queries are slow.
>
> I did this kind of query:
>
> SELECT relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze
> FROM pg_stat_all_tables
> WHERE schemaname = 'myschema';
>
> And noticed null values for everything, including last analyze date.
>
> Does this mean the planner won't be able to optimize for these tables?
> Do I need to do something to prep my DB for planning after upgrade?

You used pg_upgrade, right?
pg_upgrade won't migrate any table statistics.

You'll have to run ANALYZE to collect new ones.

This is even mentioned in the output of pg_upgrade,
and it writes a convenient shell script that does the
ANALYZE for you.

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Wells Oliver 2019-10-30 05:41:34 Re: Forcing analyze on DB after upgrading?
Previous Message Wells Oliver 2019-10-30 05:27:11 Re: Upgrading from 9.6 to 12 and running into cast issues with pg_catalog.text()