Re: Stats update difference between VACUUM ANALYZE and ANALYZE in 9.2?

From: <pbj(at)cmicdo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Paul Jones <pbj(at)cmicdo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Stats update difference between VACUUM ANALYZE and ANALYZE in 9.2?
Date: 2016-09-26 15:17:38
Message-ID: 1423451870.4806251.1474903058852@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, September 26, 2016 9:44 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

 >> Paul Jones <pbj(at)cmicdo(dot)com> writes:
 >> For a freshly pg_restore'd 9.2 database, would VACUUM ANALYZE update
 >> statistics any better than just an ANALYZE?

 >
 > VACUUM would have caused the page-all-visible flags to get set for all
 > pages of unchanging tables.  I don't recall whether ANALYZE has any side
 > effects on those flags at all, but it certainly would not have set them
 > for pages it didn't even visit, which would be most.
 >
 > Net result is that the pg_class.relallvisible fractions didn't get high
 > enough to persuade the planner that index-only scans would be effective.
 > I guess you could call that a statistic, but it's really about the
 > contents of the tables' free space maps.
 
 >
 >             regards, tom lane

This is good to know.  I think we will be running VACUUM ANALYZE from
now on after restore instead of just ANALYZE.
 
I do note that sect. 49.11 claims that ANALYZE updates
pg_class.relallvisible.  I don't know if this is a documentation problem
in light of what you explained.

PJ

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dbyzaa@163.com 2016-09-26 15:39:11 temporary table vs array performance
Previous Message Tom Lane 2016-09-26 14:58:41 Re: Chante domain type - Postgres 9.2