‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, October 19th, 2021 at 01:02, Euler Taveira <[email protected]> wrote:
> On Mon, Oct 18, 2021, at 8:53 PM, Alvaro Herrera wrote: > > > On 2021-Oct-18, David G. Johnston wrote: > > > > > On Mon, Oct 18, 2021 at 4:02 PM Alvaro Herrera <[email protected]> > > > wrote: > > > > > > Given that the first stage uses statistic target=1, running this option > > > > in a database with any stats at all is probably a bad idea. > > > > > > Add the word "only"? > > > > > > This option is only useful to analyze a database... > > > > Maybe this is sufficient, since it would drive people away from trying > > to do anything else than help upgrades with it. > > +1. I like your 2nd suggestion. > > "This option is only useful to analyze a database that was newly populated > from > a restored dump or by <command>pg_upgrade</command>. Beware that running with > this option in a database with existing statistics may cause query optimizer > choices to become transiently worse, because of the very low statistics target > that is used in the early stages." > > > > "Run several (currently three) stages of analyze with different > > > configuration settings, to produce usable statistics faster. The first of > > > these stages will remove any existing statistics even if they use a larger > > > statistic target configuration." > > > > .. yeah, this is another option. > > We might include it too but I would suggest "replace" instead of "remove" > because it seems there won't be statistics after the first stage. Given all the suggestions I've tried to combine them into one patch again. Regards, Nikolai
diff --git i/doc/src/sgml/ref/vacuumdb.sgml w/doc/src/sgml/ref/vacuumdb.sgml
index 223b986..05a288a 100644
--- i/doc/src/sgml/ref/vacuumdb.sgml
+++ w/doc/src/sgml/ref/vacuumdb.sgml
@@ -397,17 +397,19 @@ PostgreSQL documentation
<listitem>
<para>
Only calculate statistics for use by the optimizer (no vacuum),
- like <option>--analyze-only</option>. Run several (currently three)
- stages of analyze with different configuration settings, to produce
- usable statistics faster.
+ like <option>--analyze-only</option>. Run three stages of
+ analyze. The first stage uses a low statistics target
+ (see <xref linkend="guc-default-statistics-target"/>)
+ to produce statistics quickly, and subsequent stages build the
+ full statistics. Be aware running this option in a database
+ with statistics may cause the query optimizer choices to become transiently
+ worse due to the very low statistics targets of the early stages.
</para>
<para>
- This option is useful to analyze a database that was newly populated
- from a restored dump or by <command>pg_upgrade</command>. This option
- will try to create some statistics as fast as possible, to make the
- database usable, and then produce full statistics in the subsequent
- stages.
+ This option is only useful to analyze a database that current has no,
+ or wholly incorrect, statistics e.g. it was newly populated
+ from a restored dump or by <command>pg_upgrade</command>.
</para>
</listitem>
</varlistentry>
signature.asc
Description: OpenPGP digital signature
