pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Wells Oliver <wells.oliver@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Forcing analyze on DB after upgrading?
Date: Wed, 30 Oct 2019 06:38:38 +0100
Message-ID: <7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at> (raw)
In-Reply-To: <CAOC+FBUsOAKGBdNVmr2OSiRq7nLw=5jWMRjd9C5AWT6TVLXU-A@mail.gmail.com>
References: <CAOC+FBUsOAKGBdNVmr2OSiRq7nLw=5jWMRjd9C5AWT6TVLXU-A@mail.gmail.com>

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






view thread (4+ messages)  latest in thread

Message-ID: <7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at>
Permalink:  ../7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at/
Also on:    postgresql.org/message-id/7fd7f4eb1073884acfb673580f5ff589fcbf7abe.camel@cybertec.at

 · 

reply

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, wells.oliver@gmail.com
  Subject: Re: Forcing analyze on DB after upgrading?
  In-Reply-To: <7fd7f4eb1073884acfb673580f5ff589fcbf7abe.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