public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jeff Davis <[email protected]>
To: [email protected]
Subject: pgsql: CREATE INDEX: don't update table stats if autovacuum=off.
Date: Fri, 07 Mar 2025 03:40:24 +0000
Message-ID: <[email protected]> (raw)

CREATE INDEX: don't update table stats if autovacuum=off.

We previously fixed this for binary upgrade in 71b66171d0, but a
similar problem remained when dumping statistics without data.

Fix by not opportunistically updating table stats during CREATE INDEX
when autovacuum is disabled. For stats to be stable at all, the server
needs to be aware that it should not take every opportunity to update
stats. Per discussion, autovacuum=off is a signal that the user
expects stats to be stable; though if necessary, we could create
a more specific mode in the future.

Reported-by: Ashutosh Bapat <[email protected]>
Discussion: https://postgr.es/m/CAExHW5vf9D+8-a5_BEX3y=2y_xY9hiCxV1=C+FnxDvfprWvkng@mail.gmail.com
Discussion: https://postgr.es/m/ca81cbf6e6ea2af838df972801ad4da52640a503.camel%40j-davis.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d611f8b1587b8f30caa7c0da99ae5d28e914d54f

Modified Files
--------------
src/backend/catalog/index.c                | 22 ++++++++++++++++++++++
src/test/regress/expected/stats_import.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/stats_import.sql      | 17 +++++++++++++++++
3 files changed, 68 insertions(+)



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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: CREATE INDEX: don't update table stats if autovacuum=off.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox