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 1ujf5q-00AQm7-LF for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 14:26:14 +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 1ujf5o-00GRfK-Kh for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 14:26:12 +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 1ujf5o-00GRfC-8N for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 14:26:12 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ujf5l-0013JO-2J for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 14:26:11 +0000 Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3e40050551bso48241025ab.2 for ; Wed, 06 Aug 2025 07:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754490370; x=1755095170; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Cxt3ONwur82DcMePvhK5Fbym6s5Oj9sXWz+CKKG4/p8=; b=jwZuNOJEP7X2LvWpl1n0kyFqOlQaV1rq527dlb9D2Em8UFMaWkE4lcuH/WpGkUhlVP XGgcuExnheM0FdRVIdDzDEYmr3+SvDOaR6/WcZKBBvL+Pe2GbsL8mucq8M078cIkm5uO +I1tQt0fcMLiEGco3BzPQK329PgwwTtw7BWxcGQy8cP7u3wl/ZlxF9n1b9jCabJQfa3H gpKZ6lE3e0OHHtRDKsN3RarvcDhSolfyijYuxn6+XQmfZxayCtilt6vryFma3kdsI5iV Lo+1AYVgS4d23U1dHq2TVLmIc6C+Axs9QmxWNQuzviXdtGwrXu+ovmDltl3FyAIUV+Am SzAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754490370; x=1755095170; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cxt3ONwur82DcMePvhK5Fbym6s5Oj9sXWz+CKKG4/p8=; b=ddjSOd3MRYUAHYqwyTVCUWS2WjcHdWLT9CB1UcdlhGcMY3WsqBn8v45Z35MAwAI9mu GggWMZnjZGSq3gWct581O26RDIXANNz6g4qc6VmJ5yntMp6Vujhq5DqfsSBd8DXrYmZm PgCJA4iNGtbpIhiYol5TGZ1oIbRMaJx6hbJyaAacrJOUhPd1O14th8yZ7RWrq7Hwob+S YTqOWHJYRnF+3MoWBUop2oxJ+cXAj0fSZO5rljJlaXVBikWo6vNGqkORx4LkfmXPa1vR ZeuXEAAzMzNWu7v+cPeu0YHwbxho3wk7fVj6lUWYYxu5rWf1dA9PlduF43RkJOLZtJ6Q 0pjQ== X-Forwarded-Encrypted: i=1; AJvYcCV6go6ihinR6hGCbQ3IAlziiL/440ENGS34GYUNvVOamtV+IEHI0R8VXX48+f8QOfIsgkH9J/xznDo1Lniu@lists.postgresql.org X-Gm-Message-State: AOJu0YwzXyj3jSHyZxOY+KSBsPtlnJ0kmqttLw4ECCLLDo6BPkILu1bE yzhOMSU1L8oQcnJ8q2PUMr4a7MwXqvG5AeF0KO4lwe0GXkoYIhnZmVlbNQQTYIKIy4voBKldlXV NsM/cBfQPV3ootkhXGXD1Oc2X5v5WNwI= X-Gm-Gg: ASbGncvoGZUMY3ewrjLeNkuUBQ+HM+mzFuOlQWfQrcZYovVHbPRZ7glLhGM0T8/zIXp 2SGFamxcD4Ibxm8Pft/rlBlBzmi7+ZIQ4OOdoh9W+W3P32nX1PgUy60mdFFknBcxeynAj1bCrMN bUGCD+2XC+p8rEinh0/yZL8jY83+XFGtFjSR+NRPbuelpbjXTc6szq3kQNFNuiy1plze0Q+QjwH R3kveuKGew+1xHf4zP5I2jcUGECtW5Ey+uUYAg01w== X-Google-Smtp-Source: AGHT+IGcKwlwLyWbVujF6bQjENhht1hnYgL7ngFKqNcY9mKktVewCweXyw0Bj7h2jKgmfMnKLoGnzUt+HHFulbLRbQw= X-Received: by 2002:a05:6e02:2404:b0:3e3:ff59:6906 with SMTP id e9e14a558f8ab-3e51b8fe026mr48515055ab.11.1754490369802; Wed, 06 Aug 2025 07:26:09 -0700 (PDT) MIME-Version: 1.0 References: <6add2a9a-7cf2-4d1b-8f3e-2e26a7ebe883@aklaver.com> <4d8122febd3007143504e4b6034b4253f7000761.camel@cybertec.at> <08d943a83590308cbb9be594d80b4e19ca80e08e.camel@cybertec.at> <2505eef1-b6aa-4518-baff-861a2e6a507b@gmail.com> <2c1f1834107045dfa8b32417771b56bab0cffc56.camel@cybertec.at> <2cce9851-327a-4b1a-ab8e-531c2f92532b@gmail.com> <9c9cb744-b8c7-4d75-acad-595b3faba187@gmail.com> In-Reply-To: <9c9cb744-b8c7-4d75-acad-595b3faba187@gmail.com> From: Fujii Masao Date: Wed, 6 Aug 2025 23:25:53 +0900 X-Gm-Features: Ac12FXxaGFUBE8Q8VpDSADYeetNYXsq8dyeCXRWYH1XtScVUShtNCVDMTRM72XQ Message-ID: Subject: Re: analyze-in-stages post upgrade questions To: Mircea Cadariu Cc: Laurenz Albe , "Zechman, Derek S" , Adrian Klaver , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Aug 6, 2025 at 1:01=E2=80=AFPM Mircea Cadariu wrote: > Overall, I like the change. But I have one question: should this be treat= ed as > a bug fix that we back-patch to supported branches, or is it more of > an improvement that should only go into master? > > I reckon it might make sense to back-patch it to previous versions, as us= ers might not upgrade always to the latest version. I understand your point. But on second thought, since the patch changes behavior, I'm leaning toward treating it as an improvement, so it should only go to master... > + /* > + * VACUUMing partitioned tables would be unreasonably expensive, since > + * that entails processing the partitions twice (once as part of the > + * partitioned table, once as tables in their own right) for no > + * benefit. But if we only ANALYZE, collecting statistics for > + * partitioned tables is worth the effort. > + */ > > This is probably true. But isn't the main reason more about aligning with > the behavior of the underlying VACUUM and ANALYZE commands? As the vacuum= db > docs says, "There is no effective difference between vacuuming and analyz= ing > databases via this utility and via other methods for accessing the server= .", > so its default target objects should match: VACUUM skips partitioned tabl= es > by default, while ANALYZE includes them. If that's the case, maybe the co= mment > should reflect that instead. > > I see what you mean. From that perspective, I wonder if we even need a co= mment there at all. Or, if we keep it, though, I'd like to update it to something like the following: -------------------- vacuumdb should generally follow the behavior of the underlying VACUUM and ANALYZE commands. If analyze_only is true, process regular tables, materialized views, and partitioned tables, just like ANALYZE (with no specific target tables) does. Otherwise, process only regular tables and materialized views, since VACUUM skips partitioned tables when no target tables are specified. -------------------- Regards, --=20 Fujii Masao