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 1lUz45-0006EG-Iv for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Apr 2021 21:53:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUz43-0003TZ-FA for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Apr 2021 21:53:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUz43-0003TR-87 for pgsql-hackers@lists.postgresql.org; Fri, 09 Apr 2021 21:53:19 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lUz40-0003xU-7q for pgsql-hackers@lists.postgresql.org; Fri, 09 Apr 2021 21:53:17 +0000 Received: by mail-ed1-x52c.google.com with SMTP id s15so8182207edd.4 for ; Fri, 09 Apr 2021 14:53:15 -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=Y6JwiY4OqgCF1C3bvgfgle1CuQ07S+RRzRkCiBjorxc=; b=McymcrPLqaeGaWwOCalbecpSJw/NvAxwXxKZK9V7Fkm3bGm3AQflBZyTWrhBiqQ+WA SjdE0/X9yyHDCfCCYKwfZBcNDhwb1wtOQGSAGM1QbQSNM17YnNqWV/wQBoIOrRncX1l8 X1A0QTFKBj90/Kk/MV2NBWA2LIT0gU49UnBq/4YrBusPtpydUl57utTgWHq9ZPYyldIr ZWIvIn1DdQe36gMD2kbsBOyotr7IStRHWACZ6jd+PP8bng8Vb0uvgCyLhCWMvhLzm+Mp nlNOHPWDcJv0/n/VqDA3cQII7XGZUlylPN4OfAMQLL9T1Dwe2TxjNJlYujjpUMxwD/f7 MaEQ== 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=Y6JwiY4OqgCF1C3bvgfgle1CuQ07S+RRzRkCiBjorxc=; b=Z9FjQvmjYgJsuqtK7hD6xw8GvNtBGThfdAWob1gzxEixgB3861yVMNBFBKn4VWqwQJ lCib0f5ADvZG8a1Ox/qcLigbReuTRh6FHY52mFMvw9wZbDepme0vTHJY6vgAFfxmzdPg iRggyggVYWm0sCITygikFjYtWVofQ9cu+xtNtnSpi26YqN7ioqEkdzHFPojKux9w75/h 7gsZxEv8sdjXGrR5ZL9pmsdjydjJLT6SK8H95wKgWh/en1Ue45pVdXT8iEMXDHd+Hgtz NUeGQogPltgXlKyLsFq4ScsfdFDyzHiUGVUPXjhGK897Yx0v5qSKjEuNPmUJip+69Vae dWpg== X-Gm-Message-State: AOAM532UCRl/j/aNVQfbzLs/uVnM1voyQGUQAesvapmNPXE3GHk8Psv9 vBt37JBxxgFBaYxegZGvpYHQynVwoPriyPO2GRpzVwjKLB0gVstlesNG1QWGlihFAV5kDUPSIJk yigi0j56xhcPA+wLuMQKcbmJy5SwVq02BwZ6yvJ9roNLbYvB7X1SLboh+eYUhIFVevF5od7niJb KUq9WytpouI+OGTCQ5BKihtWaO2jwzdHvXxDeeCTWLOxv/KrzEbT+G X-Google-Smtp-Source: ABdhPJxlrrSzkHk9QmYb/Je/i/ffenM7bAHx8iMUO8OgswyDxjzlGsfSTdooJC2G/zpJjczVf/UveQ== X-Received: by 2002:aa7:d84b:: with SMTP id f11mr19231266eds.149.1618005193660; Fri, 09 Apr 2021 14:53:13 -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 t15sm2209033edw.84.2021.04.09.14.53.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Apr 2021 14:53:12 -0700 (PDT) Subject: Re: pgsql: autovacuum: handle analyze for partitioned tables To: Justin Pryzby , Alvaro Herrera Cc: Robert Haas , Tom Lane , Zhihong Yu , pgsql-hackers@lists.postgresql.org, Yuzuko References: <20210409213155.GA23912@alvherre.pgsql> <20210409214508.GV6592@telsasoft.com> From: Tomas Vondra Message-ID: Date: Fri, 9 Apr 2021 23:53:08 +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: <20210409214508.GV6592@telsasoft.com> 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/9/21 11:45 PM, Justin Pryzby wrote: > On Fri, Apr 09, 2021 at 05:31:55PM -0400, Alvaro Herrera wrote: >> On 2021-Apr-09, Robert Haas wrote: >> >>> Does this need to worry about new partitions getting attached to a >>> partitioned table, or old ones getting detached? (Maybe it does >>> already, not sure.) >> >> Good question. It does not. > > I think there's probably cases where this is desirable, and cases where it's > undesirable, so I don't think it's necessarily a problem. > > One data point: we do DETACH/ATTACH tables during normal operation, before > type-promoting ALTERs, to avoid worst-case disk use, and to avoid locking the > table for a long time. It'd be undesirable (but maybe of no great consequence) > to trigger an ALTER when we DETACH them, since we'll re-ATTACH it shortly > afterwards. > > However, I think DROP should be handled ? > IMHO we should prefer the default behavior which favors having updated statistics, and maybe have a way to override it for individual commands. So ATTACH would update changes_since_analyze by default, but it would be possible to disable that. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company