integrate pg_upgrade analyze_new_cluster.sh into vacuumdb

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: integrate pg_upgrade analyze_new_cluster.sh into vacuumdb
Date: 2014-01-09 03:15:23
Message-ID: 1389237323.30068.8.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pg_upgrade creates a script analyze_new_cluster.{sh|bat} that runs
vacuumdb --analyze-only in three stages with different statistics target
settings to get a fresh cluster analyzed faster. I think this behavior
is also useful for clusters or databases freshly created by pg_restore
or any other loading mechanism, so it's suboptimal to have this
constrained to pg_upgrade.

Therefore, I suggest to add this functionality into the vacuumdb
program. The attached patch shows how this could work. I have added an
option --analyze-in-stages (stupid name) that triggers the same logic as
the pg_upgrade script.

There are some details to be considered about who pg_upgrade would call
this. For example, would we keep creating the script and just have the
script call vacuumdb with the new option, or would we skip the script
altogether and just print a message from pg_upgrade? Also, pg_upgrade
contains logic to run a vacuum (not only analyze) in the final run when
upgrading from PostgreSQL <8.4 to deal with the freespace map. Not sure
how to adapt that; maybe just keep the script and run a non-analyze
vacuum after the analyze.

Attachment Content-Type Size
vacuumdb-analyze-in-stages.patch text/x-patch 7.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-01-09 03:17:02 newlines at end of generated SQL
Previous Message Fabrízio de Royes Mello 2014-01-09 01:47:08 Re: commit fest manager?