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 1ufyu5-00EMCS-87 for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jul 2025 10:46:53 +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 1ufyu2-00GJBD-OV for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Jul 2025 10:46:51 +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 1ufyu2-00GJAz-BH for pgsql-hackers@lists.postgresql.org; Sun, 27 Jul 2025 10:46:50 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1ufyu0-0011dp-0v for pgsql-hackers@lists.postgresql.org; Sun, 27 Jul 2025 10:46:49 +0000 Received: from [192.168.0.7] (5-49-10-71.hfc.dyn.abo.bbox.fr [5.49.10.71]) by mail.dalibo.com (Postfix) with ESMTPSA id 5DB0326352; Sun, 27 Jul 2025 12:46:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1753613205; bh=wDsgJkE07Mp42Kahig1dDqKAI0giZ/HMThckpTV40X4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=K4/HyePqea2HxQWIeSktrbO9CANM7vpTXsQA5QxiAuT9ab0meLXiv8loIkWv9ibAa ZXgT0kJD+i5dmm55ZWBdcu98CCHv7CtXwB30jBmgx81gYyQ9T21UUH1eAi17kIA1kN RgKeW2guuTeXqLxeT2dkebcTW2KtMUoY9Uz9loq8= Message-ID: <8320fa2e-9200-46e2-b905-4a4d84707020@dalibo.com> Date: Sun, 27 Jul 2025 12:46:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: vacuumdb changes for stats import/export To: Corey Huinker , Bruce Momjian Cc: "David G. Johnston" , Nathan Bossart , 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 References: <4b94ca16-7a6d-4581-b2aa-4ea79dbc082a@dalibo.com> From: =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= Content-Language: fr, en-US Autocrypt: addr=frederic.yhuel@dalibo.com; keydata= xjMEXn3bgxYJKwYBBAHaRw8BAQdA6tX5FT/n5ztMWIoBdl6k5avvu65fv6ryfVzIx/aH3V3N JEYuIFlodWVsIDxmcmVkZXJpYy55aHVlbEBkYWxpYm8uY29tPsKWBBMWCAA+FiEEi7OTyf6H ePS+C6n11XGWhN8zGNUFAmZDVJ8CGwMFCQtfi90FCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQ1XGWhN8zGNV65gEA6o+UrebFjn2CIAOYwP3CiiJugiM5TMH9yJyehQua5ZoA/2ChxiVn 8OUaAw/ErxJmQi1mSN0tNZBL/KhkUPBDUDQNzjgEXn3bgxIKKwYBBAGXVQEFAQEHQCuh5cLQ AtEBXHa2Fmtp0kduBu7msM7qO/gaEcdjFUdiAwEIB8J+BBgWCAAmAhsMFiEEi7OTyf6HePS+ C6n11XGWhN8zGNUFAmZDVJ8FCQtfi90ACgkQ1XGWhN8zGNWOOAEArSqePBqfd4Kx4ulACaWO 6fM+XSDfUlBAQXx9rU6DR4MBALwozl9g91tRysim6lKxggvBfp/PvbpTZNrxYLWB2fYP In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/26/25 21:38, Corey Huinker wrote: >=20 >=20 > It is transactional, mostly. >=20 > The attribute stats for the table being analyzed and all attribute stat= s=20 > for the dependent indexes that have at least one expression column, plu= s=20 > extended stats objects on that table, will be replaced in one atomic=20 > operation. The old stats were there,=C2=A0commit happens, now the new s= tats=20 > are there. >=20 > The relation stats (pg_class) happen in-place, non-transactionally. So=20 > if you had an analyze that got canceled, and some of the relstats had=20 > been updated on the table or indexes, those would stay as-is. >=20 Then it seems very unlikely that the query optimizer's choices become=20 transiently worse because of that, doesn't it? and this shouldn't be=20 used to justify this option, IMHO. How about this? "This option is primarily intended to be used in=20 post-upgrade scripts to quickly generate minimal optimizer statistics" > Having said all that, these are very nitpick details that may not need=20 > to be in our documentation. >=20 +1 I've always supposed that the statistics were completely transactional,=20 I think most users do, and the difference with reality seems small enough= . >=20 >=20 >=20 > /me dons Hat of Pedantry=C2=A0(+2 against simple explanations) >=20 > "Specifying this option then limits the result to only tables that are=20 > missing an attribute statistic, have an index that is missing an=20 > attribute statistic, or have an extended statistics object that is=20 > itself missing object statistics". >=20 > /me removes hat >=20 > "Specifying this option then limits the result to only those tables tha= t=20 > do not already have complete statistics." >=20 > The above phrase is asking the word "complete" to do a lot of heavy=20 > lifting, covering the dependent indexes and extended statistics objects= .=20 > Specifying "table" makes it clear that any deficit in statistics result= s=20 > in the table getting analyzed, not just the single index or extended ob= ject. FWIW I much prefer the last, simple phrase.