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 1ugwtS-008vGu-P8 for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jul 2025 02:50:15 +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 1ugwtR-0065hd-Bz for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jul 2025 02:50:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ugwtQ-0065h1-V7 for pgsql-hackers@lists.postgresql.org; Wed, 30 Jul 2025 02:50:13 +0000 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ugwtN-001aln-3D for pgsql-hackers@lists.postgresql.org; Wed, 30 Jul 2025 02:50:12 +0000 Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-87c11fd5364so232813639f.1 for ; Tue, 29 Jul 2025 19:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753843809; x=1754448609; 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=MEF2AW3Z0jW4CupCorqCB8IFEz82mKmaWs+zyIY9VPA=; b=OFj+MxbIurAvn2KBlTRP1S/QAjkJc6i4zQSYT6QP1Z1ST5uLkOHdv3udUgAesXQkRq IK9BQS7GUzVegHZa7/G87uAsvvISpk+AHZ/TrMbjW9NlK7KxTcDDtfeZhfoIcVuQQHOt 5EqVYPI4DByzN8gkxEYWV7OV3+I+KHbKdOyHGqCXqMzRezvm8GtjvZ5SjdI+UWoeNScn n0oyi//SrmqwxOGQlIcIz3N8GFTdeoRGtH4kSLIC+U7zLacOqu27ohlDC3auMP5MT+lQ CSfEMvO90+hU3/xvm9E6iCi52wDbFzkxPGQsgwV4KYllv7UyG+65d+dJyPPyfPafybF5 oZqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753843809; x=1754448609; 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=MEF2AW3Z0jW4CupCorqCB8IFEz82mKmaWs+zyIY9VPA=; b=cvfX0yaqmbbzFYCgzxHZwkPyqQtCn1gxXff6EOCh7a/g1jVi7C585rtv0fAgdgnp7Q FFa2UhBhREbLSjJ7X2kc20elI8UKbw9s2mraHE4vKQ+DwufqRY6ILbkv7PG/8n9hQ9br n5VuYxJ3wQwwYEXyGfENdCsUO/clmmWVfxRBGzUrhPnV07WTcev3XmmGxzDITCLRmYFO 39zrcp/pRRmNvVWdmoriY7Pf+egBKBUhVZxu9EaITX/lYal9taMrCbWkseUqHC7z9cpW YotB9oMYNJNITtnKGj1TIM9h8ZsFjimxfGP8ss6BStVIJruyX5mAoMGRLyZQR1o6VVs3 zODg== X-Forwarded-Encrypted: i=1; AJvYcCU0cdqF7HqQAv46vWUcaGsiZDOu4ihfwZeB5WGjTxL4TNTVWemfr5UMWwyU2e399OS4JHbKxuF4cFluPHx3@lists.postgresql.org X-Gm-Message-State: AOJu0Yzm1499CpftOyuMzeOiDuEk4hYxajnME4XCfe2AkzW+EgYGV+77 EAhuqtAFU0xE2kiNHzx2Ok4jFLdZCYRrrRbzw1PBRmGQzv0+lkkvoGVR1nJMeSfqb5CtgUUQM3C Vlv5CfTy1fesXULgShGjPvo83SGR2mNM= X-Gm-Gg: ASbGnctgVwULiXxVNN+Q21sZYx42GKYcRW5+T9WyynV4Ijphz2C0P75tcMf0q7y7Lyj EjrO59h5g673QwqJmRev2YG4XhKCRPaBAWhB+JuPd16cpua5ILFYmu3lcGaTOwdmGDiPC5dxlMs BUWdMe6NbM8upZC3aV0k91qpSHwupZr3HtbJqDRhrhTvE864ZjfHZesV2F/kwiA9ThrvyoNyBkt 0//WbJPL5TakekWnP+tg14R2LOZGJliEEINl0KvYPer25G3ow== X-Google-Smtp-Source: AGHT+IF3DpPLAytCCZkkG26ZDwQbHREnxxDUMBlqY2kf53yXcHDCBh15CyDs9tvlsjUVwNiEWXxi3hmCZAUY2cSymxI= X-Received: by 2002:a05:6e02:1153:b0:3df:4ad5:3a71 with SMTP id e9e14a558f8ab-3e3f6281568mr20841435ab.11.1753843808662; Tue, 29 Jul 2025 19:50:08 -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> In-Reply-To: <2cce9851-327a-4b1a-ab8e-531c2f92532b@gmail.com> From: Fujii Masao Date: Wed, 30 Jul 2025 11:49:56 +0900 X-Gm-Features: Ac12FXwvPpUxBMmdtNBw6GNoAXUH6LLMwXBbJGX_gjflGRmuIQeFoQKmBu3HRHg 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 Fri, Jul 11, 2025 at 7:42=E2=80=AFPM Mircea Cadariu wrote: > > On 11/07/2025 10:51, Laurenz Albe wrote: > > > Good idea; done in the attached version 2 of the patch. > > Thanks! Looks good. I have set the status of the Commitfest entry to > "Ready for Committer". I've started reviewing the patch since it's marked as ready for committer. Overall, I like the change. But I have one question: should this be treated= as a bug fix that we back-patch to supported branches, or is it more of an improvement that should only go into master? Only calculate statistics for use by the optimizer (no vacuum). + If that option is specified, vacuumdb will also + process partitioned tables. Without that option, only the partiti= ons + will be considered, unless a partitioned table is explicitly speci= fied + with the option. This wording seems a bit out of place in the --analyze-only section, since it also describes the default behavior of vacuumdb without that optio= n. Wouldn't it make more sense to move that explanation in the --table section= ? For example, we could add something like: ------------------ If no tables are specified with the --table option, vacuumdb will clean all regular tables and materialized views in the connected database. If --analyze-only or --analyze-in-stages is also specified, it will analyze all regular tables, partitioned tables, and materialized views (but not foreign tables). ------------------ + /* + * 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 vacuumdb docs says, "There is no effective difference between vacuuming and analyzin= g databases via this utility and via other methods for accessing the server."= , so its default target objects should match: VACUUM skips partitioned tables by default, while ANALYZE includes them. If that's the case, maybe the comm= ent should reflect that instead. + qr/statement:\s+ANALYZE\s+public\.parent_table/s, + '--analyze_only updates statistics for partitioned tables'); A plain space might be sufficient instead of \s+. Also, I don't think the backslash before ".parent_table" is necessary. Regards, --=20 Fujii Masao