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 1mwT1y-0004gm-J4 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Dec 2021 17:53:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwT1x-0001dC-E1 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Dec 2021 17:53:01 +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 1mwT1w-0001d3-UV for pgsql-hackers@lists.postgresql.org; Sun, 12 Dec 2021 17:53:01 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwT1u-0003Dv-7H for pgsql-hackers@postgresql.org; Sun, 12 Dec 2021 17:52:59 +0000 Received: by mail-il1-x129.google.com with SMTP id d14so10734937ila.1 for ; Sun, 12 Dec 2021 09:52:57 -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=3wxmPtekcBDnHHI14AFT3LvQYn1jNXo4gElb8kSiE64=; b=YVeOKSpYQvm2WO7b/TdCV/XuZ6XpW12pJYgITpav055ebmz+Vf47oP39bTI4J8ZIPT rJZh0/LjAse00TAc2k0cFTi2aFnFeD31KRG4V2VLzI9BkjV3U3aa3hovI5wiBNxFaTmq qLL/n856YoXSLyPzRWlOWmN2htfinEN0hKGFY/bJJwnwB1M939Xtg9hRGDk/zvv/lJru qmC7WYCl+b1h/k1tBI6prfidFpyNTz9FYcHNdpsK6d6jZ5c8GdmeoSbkoXQbqEYU8A5Z W6P3NdSG75Ec95GFdpHQKcUP2YZ6EcJarWDHWDY9spcoO75OMehn5UbgwKV0ZB6CIyJz TVQA== 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=3wxmPtekcBDnHHI14AFT3LvQYn1jNXo4gElb8kSiE64=; b=rjH9BzJhVYnSijOVGoZPHwAUQSSuABrZQhLsh43unVKz6U4B2E3YTvymVDHh3to1iH 8N+WZBGZUkQ/a4PQUoonpV1wXORWvXZwEL1MKcVUM/D2oVH1qZVDrj+Sm0IqMjdb1pWC sGIV7E9Fal0fBFIp4Yl6SAoBmTGD9QuBMno+GbmhhgQaHN1T1EUVw4MtJBknSQDFeu0+ px16m8O6Z9kesSMHvwC65Y+VzflK1kPNV0IhbUdIIMwk+PciNxQhxlVONXf0AvtopxSm /Xze8LnVgcoFsaxOjx6MM86O63o3zMWG0dcpYDI38jzYUEMi9HKIHFNXzX/IIqxzP0qn O0gQ== X-Gm-Message-State: AOAM533PSYmwV46byEWmGLPGqEWluDMjdGN8N6v0S+MPh5R77vhfSpVQ JDT0ThAZVidT0843nSN/eSb7Og== X-Google-Smtp-Source: ABdhPJxY6bjVaXuc9yguxn9lgKzeY9aKwthECfHv3vSvQXMPLKPwVrymrJyD34d1tcQWORBYPbkpCA== X-Received: by 2002:a92:d705:: with SMTP id m5mr3290330iln.47.1639331577295; Sun, 12 Dec 2021 09:52:57 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k13sm7549279iow.45.2021.12.12.09.52.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Dec 2021 09:52:57 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 2CD00800BC8; Sun, 12 Dec 2021 11:52:56 -0600 (CST) Date: Sun, 12 Dec 2021 11:52:56 -0600 From: Justin Pryzby To: Tomas Vondra Cc: Zhihong Yu , Jaime Casanova , pgsql-hackers@postgresql.org Subject: Re: extended stats on partitioned tables Message-ID: <20211212175255.GO17618@telsasoft.com> References: <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> <20211203052411.GU17618@telsasoft.com> <8052505e-2dd2-e8cb-26c9-cbb5dff7d750@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8052505e-2dd2-e8cb-26c9-cbb5dff7d750@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 + * XXX Can't we simply look at rte->inh? + */ + inh = root->append_rel_array == NULL ? false : + root->append_rel_array[onerel->relid]->parent_relid != 0; I think so. That's what I came up with while trying to figured this out, and it's no great surprise that it needed to be cleaned up - thanks. In your 0003 patch, the "if inh: break" isn't removed from examine_variable(), but the corresponding thing is removed everywhere else. In 0003, mcv_clauselist_selectivity still uses simple_rte_array rather than rt_fetch. The regression tests changed as a result of not populating stx_data; I think it's may be better to update like this: SELECT stxname, stxdndistinct, stxddependencies, stxdmcv, stxoid IS NULL FROM pg_statistic_ext s LEFT JOIN pg_statistic_ext_data d ON d.stxoid = s.oid WHERE s.stxname = 'ab1_a_b_stats'; There's this part about documentation for the changes in backbranches: On Sun, Sep 26, 2021 at 03:25:50PM -0500, Justin Pryzby wrote: > Also, I think in backbranches we should document what's being stored in > pg_statistic_ext, since it's pretty unintuitive: > - noninherted stats (FROM ONLY) for inheritence parents; > - inherted stats (FROM *) for partitioned tables; spellcheck: inheritence should be inheritance. All for now. I'm going to update the regression tests for dependencies and the other code paths. -- Justin