Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ufhQL-00Aakx-Io for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jul 2025 16:07:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ufhQJ-00AXDG-GD for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Jul 2025 16:06:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ufhQJ-00AXD7-6s for pgsql-hackers@lists.postgresql.org; Sat, 26 Jul 2025 16:06:59 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ufhQH-000u0v-1f for pgsql-hackers@lists.postgresql.org; Sat, 26 Jul 2025 16:06:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2025010100; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-ID:Content-Description; bh=FMQvqJCy3BPLqK83XiIsUq/fXINegq16RGankAQ70nA=; b=g/BSEahPKbNyV/93pe49ly756Y OqncvZWmutBX1GJdxdRSt2Mgo0J7yUM0cIO88d2HhVodOxvDv8BKt2l7WWSt/GmrJZVOh/QXkvtuq op5NO8bQZML8PYWl9e6rFR9Ve+VF+H6mzo+pPR7lI+1wvTA+1t6g2b1hLKMSLiiMa69VhP/T65NNV SlgWX7LBrwX+iGZ+tuvnQ0YkUIFxft3RpzlqV4OmIAONqLZmNPzC+jifY3bnmDmxYE3MQDu/0gxXE 67Vciz56cishxBcd0+chYAGOk1ads1ltdW2VlacrIoROUoECJkBymH4AJqgVazUk2Gt3JS6Woj4AH yzOAPV5Q==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1ufhQC-00GM8D-18; Sat, 26 Jul 2025 12:06:52 -0400 Date: Sat, 26 Jul 2025 12:06:52 -0400 From: Bruce Momjian To: "David G. Johnston" Cc: =?utf-8?B?RnLDqWTDqXJpYw==?= Yhuel , Nathan Bossart , Corey Huinker , John Naylor , Masahiko Sawada , Jeff Davis , jian he , Matthias van de Meent , Tom Lane , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org Subject: Re: vacuumdb changes for stats import/export Message-ID: References: <4b94ca16-7a6d-4581-b2aa-4ea79dbc082a@dalibo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jul 26, 2025 at 07:47:47AM -0700, David G. Johnston wrote: > On Sat, Jul 26, 2025, 07:23 Bruce Momjian wrote: > > On Wed, Jul 23, 2025 at 02:45:10PM +0200, Frédéric Yhuel wrote: > > > > > > On 3/18/25 22:37, Nathan Bossart wrote: > > > Committed with the following small changes: > > > > Hi, I don't really understand this sentence in > > doc/src/sgml/ref/vacuumdb.sgml: > > > > > This option prevents vacuumdb from deleting existing statistics so that > > the query optimizer's choices do not become transiently worse. > > > > I thought that the point was to avoid unnecessary post-upgrade analyzes? > > So, the full paragraph is: > > +        Only analyze relations that are missing statistics for a column, > index > +        expression, or extended statistics object.  This option prevents > +        vacuumdb from deleting existing > statistics > +        so that the query optimizer's choices do not become transiently > worse. > > What it is trying to say is that if you run vacuumedb without this > option, not only will it analyze all tables, including ones that already > have statistics, but will drop statistics on this tables that already > have statistics for a brief period while it installs new statistics. > During that period, the optimizer will not have any statistics for the > table.  Is there a clearer way to state this? > > Statistics are transactional.  Without this option specified are we really > removing them and commiting prior to computing and saving new ones?  And we are > opposed to just changing this behavior and instead prefer to add an option that > at first glance seems like everyone should use? Yes, I thought it was transactional too, but the doc patch suggests is isn't, so maybe I am wrong. > "If not specified the system will analyze all statistics-capable objects in > alphabetical order.  Specifying this option then limits the result to only > those objects that do not already have statistics.". That may not be how the > feature strictly behaves but that would seem to be all one would expect it to > do. Yes, I would prefer the simpler text, if it is accurate. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.