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 1mt143-00044H-BQ for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Dec 2021 05:24:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mt13V-0002DJ-B5 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Dec 2021 05:24:21 +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 1mt13U-0002D9-O4 for pgsql-hackers@lists.postgresql.org; Fri, 03 Dec 2021 05:24:21 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mt13P-0005Le-IW for pgsql-hackers@postgresql.org; Fri, 03 Dec 2021 05:24:20 +0000 Received: by mail-io1-xd2c.google.com with SMTP id x10so2319546ioj.9 for ; Thu, 02 Dec 2021 21:24:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/7V5OmbfwNJfnDj4mv/1veq8iZmoOtDid71nACjXkgg=; b=Gbip9vuGsOXSa5NYj8cQRKCFYHgwhS0SlsgVvpZrkjBGyS6HsNoOxk0D+eXbi46Gvx 2BrLIlprfTXsUbJ3sGxWWT3rzemxTd0u6T3LylHdtrtMaIsUXztKpMhTTL3z2hLVJCrS Jm2EOnzTas4E+X0b/1kRcN4n5b/1EtG82k9n8N9BE0ro81uTH+Sevx9u/GSF2lS2xy3j QCOpbqXbbNASfrG17dLxEQ3k3sF9GxOL/3mWOMEeemJBSrjsC1OMKLEVFMI3oE3yXx5k dlGcPBCfE6Ips4oQaIgPuXGNsTla4pDHnYCaZDjY/qjeXal3m4psnKcj6joxBXq/b4xX 33iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/7V5OmbfwNJfnDj4mv/1veq8iZmoOtDid71nACjXkgg=; b=k+ISCDho4lNKBuCos1iumV4Ht4r5+U8CfZ5BmOjeS2bLrIqPngU31YrjOmAT7qjOJb C5bo2TPlTq+EGiql7s9owI73IxqdfObe7cCdWIWVElZbmgAnihygqy5QAfoFlcqnsqy/ rP+4rW27fzlkaL6WUkacnKEUSGLxfyrRQIBprlR9Q8w4wXW1QBdW6cCKr6pRio1JFmZu m2lX/t4FVgs8Pzsi9le5Nw2B7fcM1XENrA5GPAVZEXBa7QfIRM3KdLHA+4KmhsP2ZoJd 1E2hwRj2MWPC/rV/Davte6DfqE6q/h8QpMUaik23UIMmBkvtfY0nWK+A0PoovnR10Ts1 FsJQ== X-Gm-Message-State: AOAM533SGOGJbdVB9ZGSGrbbY8JE+qMqaCRyiI9Vnj4Dg4kjikXGQ10E eYhTu26nH3CCXD8NuUVSZ4I9ng== X-Google-Smtp-Source: ABdhPJyRbloLWm1cbAfg2+tjJ36gJPPeNDfbV2hfdz+6Dq4KVCjITfvTZoyXnFR62GBhyh/I9pQ9+g== X-Received: by 2002:a02:6f1c:: with SMTP id x28mr23172461jab.1.1638509053079; Thu, 02 Dec 2021 21:24:13 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o14sm977255ioo.36.2021.12.02.21.24.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Dec 2021 21:24:12 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 67E438008F8; Thu, 2 Dec 2021 23:24:11 -0600 (CST) Date: Thu, 2 Dec 2021 23:24:11 -0600 From: Justin Pryzby To: Tomas Vondra Cc: Jaime Casanova , pgsql-hackers@postgresql.org Subject: Re: extended stats on partitioned tables Message-ID: <20211203052411.GU17618@telsasoft.com> References: <20210923212624.GI831@telsasoft.com> <20210925223152.GA7877@telsasoft.com> <20210926202550.GA831@telsasoft.com> <20211007202646.GA9522@ahch-to> <20211007224543.GH27491@telsasoft.com> <46f37069-55cb-db6a-a15a-e351a2606592@enterprisedb.com> <20211103231904.GP17618@telsasoft.com> <689accb1-76e8-5115-6ed0-336749cdca57@enterprisedb.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qmeTShRBchLQhVIG" Content-Disposition: inline In-Reply-To: <689accb1-76e8-5115-6ed0-336749cdca57@enterprisedb.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --qmeTShRBchLQhVIG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 04, 2021 at 12:44:45AM +0100, Tomas Vondra wrote: > >> And I'm not sure we do the right thing after removing children, for example > >> (that should drop the inheritance stats, I guess). > > Do you mean for inheritance only ? Or partitions too ? > > I think for partitions, the stats should stay. > > And for inheritence, they can stay, for consistency with partitions, and since > > it does no harm. > > I think the behavior should be the same as for data in pg_statistic, > i.e. if we keep/remove those, we should do the same thing for extended > statistics. That works for column stats the way I proposed for extended stats: child stats are never removed, neither when the only child is dropped, nor when re-running analyze (that part is actually a bit odd). Rebased, fixing an intermediate compile error, and typos in the commit message. -- Justin --qmeTShRBchLQhVIG Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Do-not-use-extended-statistics-on-inheritance-trees.patch"