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 1ujl87-00BgXH-Sn for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 20:53:00 +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 1ujl85-001BVS-MZ for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Aug 2025 20:52:57 +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 1ujl85-001BVK-C1 for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 20:52:57 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ujl82-0016bq-0b for pgsql-hackers@lists.postgresql.org; Wed, 06 Aug 2025 20:52:56 +0000 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-615d0b11621so2288551a12.1 for ; Wed, 06 Aug 2025 13:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1754513573; x=1755118373; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=05hfoQXsH/sPqYi5YmPBcUrpXtegdEDrf0g64OANfL8=; b=QKuFZhB1JL3yBmj5LpkoPCzRCDkRR1VJg12ERbbrvP7sldMku6UQhsk0EwOGNAG+KJ oYAGq+oEBYXHf64HxOMXvszcCsVzSp87h0l/UFd/p48GRVn7eh241wXy8wxM87mdLExa FDD9NtgLgwLYVipAcPsCA50dzpem/DTaMzB25tX0XLVvpQ8q2Z3uxUX92mZw6um2ux+H lAPJK7S1NJznQRxZarRiCZMD5FlX1lvPOxYOp9hZKh6X40T7Sc/uAO/mDS5DKSLrJAIw GwJBMunBdkj2EPMKU49yJqaYa+vmtQSJRYrvBKjv3eWuNgGZnj6BT7rKtW6Yg/GSp6B3 zLmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754513573; x=1755118373; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=05hfoQXsH/sPqYi5YmPBcUrpXtegdEDrf0g64OANfL8=; b=j+Ys0Us1izZGGO9DT7KgPMSRzB4xgLldpTtGHKdOubGTmNlPvx6OnC8U+ESDEswobd EoRRW39XP84A+9kuSjG1pAvB5vn5hyC35KmS6n2YnPFIjRpwxZQwzgiMRC69X+hxFMmg LbW2yqK4n1wdkeD80XvDSJ1Cc9MM+6JyWRcgvk/uirOvn/wmvWKie9wTT5U+n5xQi1Kl YfpzMoYJcxNo9LI9ckqkGNIdc61YgyS6WaXjspoNZRVdxgVxQnPfjc3MOLsPDWJ0venK 5PCY8wMWmxsDQu6f1uXDBUX3f9FozTp9orBYr2/J+Oi0P3oamIFeOCPqaZ6LjSoLMJoe 1Cbw== X-Forwarded-Encrypted: i=1; AJvYcCU+MksnsM+q9vEn1suXROnK2f2oeTJuMomkMxvtydXT6desAODq0bpJPuMuM3vVeirT4W+Bie/ohxGOFqOu@lists.postgresql.org X-Gm-Message-State: AOJu0YyESKMzMJj/WMXfEEdQeh1+Bmq9PmmNAaJlHgDfWHXIQG3yahxG srhuNP4DIZv5hsB0FeXRNajD7n3f4vLbvpir/NwNKoGWuNItjgy6y+hx9VLwRxUzKTA= X-Gm-Gg: ASbGncsYjgJLDe3E1xI5fr2ErNwHLjE1gWuf1FZAe0X0BGJ4UFXTPj9ytm0s0zT9OM4 s/5pqRtnAuqobZSzcjaHcZKhaaNyO0HSPCxFdIcC9/tWJjCKYRxUIjSS9Eo3TKYB/IaeZ0a6hPv aURQvW0RNtnAmpKYQ+3k6fb7eR2JgYdVihWZ3R16ToMO9qssIi6QahyL03SLguUeSw2YmGDnkEU uF0RcdXJynLam4THEvnrCU9RSO1d9cn1xHuR/1oWWlRaOSUeMXmYwq6+/bpDThsbNu6AHo3DGNU KTTtD3URVRVf4pHNnd11h3mMIWgc04q8yCOYZAWHUGIFGCawhMcIWs1Yrz6qFX9aMEI4B4JhjEJ BmOs3HfRNeUwwo4loBPvfmHytSbwtYWcWHu7Zdcq5YO7wJeJ639yzxMGAWRz8bK0rLO800sau8f sivr8vseOWIZOh/G9SzzQ= X-Google-Smtp-Source: AGHT+IHJEj5XjfGlpG8Gqbcp/K2C4jw1IJoRoxIL+8mHVCNSHL5K5TYasvG03ug9Qa5wgDIahBHGag== X-Received: by 2002:a17:907:72c2:b0:af9:7025:7d5a with SMTP id a640c23a62f3a-af9a3d6777amr99454166b.18.1754513573453; Wed, 06 Aug 2025 13:52:53 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D (217-149-161-197.nat.highway.telekom.at. [217.149.161.197]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-af91a078afbsm1167068866b.4.2025.08.06.13.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Aug 2025 13:52:53 -0700 (PDT) Message-ID: <9a93cffe79e2be1d9450a36e773a39dc456c241e.camel@cybertec.at> Subject: Re: analyze-in-stages post upgrade questions From: Laurenz Albe To: Fujii Masao , Mircea Cadariu Cc: "Zechman, Derek S" , Adrian Klaver , pgsql-hackers@lists.postgresql.org Date: Wed, 06 Aug 2025 22:52:52 +0200 In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-1.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2025-08-06 at 23:25 +0900, Fujii Masao wrote: > 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 tre= ated as > > a bug fix that we back-patch to supported branches, or is it more of > > an improvement that should only go into master? > >=20 > > I reckon it might make sense to back-patch it to previous versions, as = users might not upgrade always to the latest version. >=20 > 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... I agree that this behavior change should not be backpatched. That is not a bugfix. > > + /* > > + * 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. > > + */ > >=20 > > This is probably true. But isn't the main reason more about aligning wi= th > > the behavior of the underlying VACUUM and ANALYZE commands? As the vacu= umdb > > docs says, "There is no effective difference between vacuuming and anal= yzing > > databases via this utility and via other methods for accessing the serv= er.", > > so its default target objects should match: VACUUM skips partitioned ta= bles > > by default, while ANALYZE includes them. If that's the case, maybe the = comment > > should reflect that instead. > >=20 > > I see what you mean. From that perspective, I wonder if we even need a = comment there at all. >=20 > Or, if we keep it, though, I'd like to update it to something like > the following: >=20 > -------------------- > 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. > -------------------- I am fine with that suggestion. Alternatively, my original comment could be amended with Besides, ANALYZE (without an option) processes partitioned tables, and "vacuumdb -Z" should behave like ANALYZE. Yours, Laurenz Albe