Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTAJa-0001nE-Mw for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Apr 2021 21:29:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lTAJX-0002eJ-R3 for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Apr 2021 21:29:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTAJX-0002eB-Fj for pgsql-hackers@lists.postgresql.org; Sun, 04 Apr 2021 21:29:47 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lTAJP-0003G1-1R for pgsql-hackers@lists.postgresql.org; Sun, 04 Apr 2021 21:29:46 +0000 Received: by mail-ej1-x636.google.com with SMTP id ap14so14486889ejc.0 for ; Sun, 04 Apr 2021 14:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VczL9zWc+7DucIzaaveRAYrQfxL+v0SfrroWyqHzQFs=; b=fE39L4TuZwVT9GynCnYS2Gft6o0hkzD2X3fdbpzJRyFvzADAxp5BHn05QZA+lMu9XF s2GhsPZE6OUFpQBqgrdd0Gk9ic4N37N+P8/iB7NYtxa5zQkEPseKE0sE8uyR0F+5qLHD OuoY8koT6TJq9MTfERinXVFNDECIE9W++cD7C1tj+QzJt1gyGfZQAkxQKeXlNORNGH/y jkeaZxBt3/zaw3G9NQplPwIavPAVcmAAIPl8WKjxYDxcE5nPQbD/BgvujCs3+mLLwJZH /ya9jHbqu2896yB8NK6aZmelEjI9Vfgq5NUs24Rh60NXjdOTbtkFftZBmajDiqJeg0uG HQDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VczL9zWc+7DucIzaaveRAYrQfxL+v0SfrroWyqHzQFs=; b=f39Lfa91e2hlVdLxKWRMmH16PRyZmoNrlX/LbkjSkwOalEwvObR1qET+8Lk5NiUi3y T94Y2inC/0MuwdQiBANGbhiWdGvEQxJc05Ko7Dhx/3v8ImFcDjXi/E2E4oMGoHDOFpus eZ9O5A8gNkTJe4S0ulbA2n1vtNLPWaSdXucaXhj7wWWoRTDs3XAJiUlWDD0AHybSh7ee xxWUdkTj/QGmbb9J5BgIYxXWpJtEf7s5rJSRnsPDO2wqlo6fqGJySO6LYzaKMNQccNYC F71cCQmvNbL3HfR/Kg+uB+MwLAJ+BJ3rA3WF0sXv5cpTS4vNh+aXmqKbjL2OnUM3rr96 w0SA== X-Gm-Message-State: AOAM533HcH2P7OsO3BR2ZHYLNtDRkBhm4fNuaTk5rWr3UliF4BH6x/Qs Q+c47xeCDadNDksLMfohXMhrIKroFsyYESjI7IvAj5ErtNmyUCRFCszzIi33hk8x4juKEQGouRW vaUTSvdXm+edRwPfLnGmn6nlWIo1ixDpbaHaRBK5r8UsNnXY8jRDUMVEp+15qWG8JPOnx/B/mlR Dvu7yhe738JtHfL9mnaHiSKumnFH2gAtQqF2X+pwnoQrnympnhrn9I X-Google-Smtp-Source: ABdhPJz6MnDdtY+jWY2NzGvnmA40/QxQKyzCVNGXWz5HQROJHr3tYka1hs4xFSPnY7fL2v/bifGy2A== X-Received: by 2002:a17:906:4cd6:: with SMTP id q22mr25241680ejt.469.1617571777185; Sun, 04 Apr 2021 14:29:37 -0700 (PDT) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id bm21sm7266963ejb.36.2021.04.04.14.29.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Apr 2021 14:29:36 -0700 (PDT) Subject: Re: Autovacuum on partitioned table (autoanalyze) To: Alvaro Herrera Cc: yuzuko , David Steele , Kyotaro Horiguchi , Justin Pryzby , Daniel Gustafsson , Amit Langote , Masahiko Sawada , Laurenz Albe , PostgreSQL Hackers , Greg Stark References: <20210404200514.GA5220@alvherre.pgsql> From: Tomas Vondra Message-ID: Date: Sun, 4 Apr 2021 23:29:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210404200514.GA5220@alvherre.pgsql> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/4/21 10:05 PM, Alvaro Herrera wrote: > On 2021-Apr-04, Tomas Vondra wrote: > >> 1) I still don't understand why inheritance and declarative partitioning >> are treated differently. Seems unnecessary nad surprising, but maybe >> there's a good reason? > > I suppose the rationale is that for inheritance we have always done it > that way -- similar things have been done that way for inheritance > historically, to avoid messing with long-standing behavior. We have > done that in a bunch of places -- DDL behavior, FKs, etc. Maybe in this > case it's not justified. It *will* change behavior, in the sense that > we are going to capture stats that have never been captured before. > That might or might not affect query plans for designs using regular > inheritance. But it seems reasonable to think that those changes will > be for the good; and if it does break plans for some people and they > want to revert to the original behavior, they can just set > autovacuum_enabled to off for the parent tables. > > So, I agree that we should enable this new feature for inheritance > parents too. > Not sure. AFAICS the missing stats on parents are an issue both for inheritance and partitioning. Maybe there is a reason to maintain the current behavior with inheritance, but I don't see it. With the other features, I think the reason for not implementing that for inheritance was that it'd be more complex, compared to declarative partitioning (which has stricter limitations on the partitions, etc.). But in this case I think there's no difference in complexity, the same code can handle both cases. In fact, one of the first posts in this threads links to this: https://www.postgresql.org/message-id/4823.1262132964%40sss.pgh.pa.us i.e. Tom actually proposed doing something like this back in 2009, so presumably he though it's desirable back then. OTOH he argued against adding another per-table counter and proposed essentially what the patch did before, i.e. propagating the counter after analyze. But we know that may trigger analyze too often ... regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company