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 1mwT19-0004bW-Gg for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Dec 2021 17:52:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwT18-0007QL-1D for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Dec 2021 17:52:10 +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 1mwT17-0007NE-C7 for pgsql-hackers@lists.postgresql.org; Sun, 12 Dec 2021 17:52:09 +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 1mwT12-0003Cb-AG for pgsql-hackers@postgresql.org; Sun, 12 Dec 2021 17:52:07 +0000 Received: by mail-ed1-x52c.google.com with SMTP id z5so45982979edd.3 for ; Sun, 12 Dec 2021 09:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=xVf533vhGAFqUmCccEd3xmXD44I8wyNCUxbM/8/P1No=; b=hVeFz+SbLyMCcWpNhuTktI8B6+vXLfIw4RjDfhHJM27KC7dNn2LXQJo02bkrmcj+ZZ vzqeeI7g749vPQwJCO495/Tftq7kMBUctTt46ZFMBzNbn8LuEXqxrW45N1KZ+tGRV+qW /Lt1o03HZItHzPmOTQEpoiH5HId3zb2Kafcb5XLhFcf0f88+avc8o735O11Q9q5zfz8U 5aoSP1e02ydjhUlvW4NxPD3LjAf6nbD7IigWgx8kizL1sUJDce79o9mLsivQMq7w0PME lxh5Hsj6dXdJEnPAcHq4AcfaBJK8w+U9n6Qwl9Y63sBLsJiriP1tIJzS4bsDP0UNh3Na 5nbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=xVf533vhGAFqUmCccEd3xmXD44I8wyNCUxbM/8/P1No=; b=ihe6JTj/eg4zfSQjD1Un7+BDe1qsVzo9WQh/G85xpYRnOUSfR9Ol18zULIsRAdE69p u51QuSiVg+YAAgCCo0HeRUZ7ZHN6w47ZUy/qmeOoAFstYlvnnIp4VWwo3POGJwezzIe5 k9KMQeTu08eY/ISC1IwvoGGm5uXVIVa1JjMSI/7WADpG5DUIM0dbgoA8Kq5Axu+Um8yS GMdwr9GLuajhWypLfp3YXkP2iowN2DyyOGF4KuEO0ycXmGZrh/Zx47WmwyCdQKbe9myW MhuRWVoouoOcxkiL1pS6h4xh5tze/8JLrNlyUmh6Q5PuBsaSPjoCz9IuUEyjEcpVh3Da /QpA== X-Gm-Message-State: AOAM533hsaO8yQ9krmH2hFbouudJV/PkcIttl5k5QNztpcR7QKOGUxyq tvcDIRk0Qouco98c+NTXMQTekQWIti79XBaRDcoPm7z4D6Nh56usarhMKlvNe28JM4H07aYW7FG U6zxLatjmKIXevi8u6vSiYxXvyIS8P1SKMU7Q5alcFJZywZHfYZSM8r9bCwy37jf8PLZcdjlLXi F4YD0r8waVUswV8mCbUh/G8Z6q3X9Mq7/z/yMJ X-Google-Smtp-Source: ABdhPJxXQLX2k0c4/QmSAQBCpUM6b4YGG8ezRazn5VCxlO9XFNI/PvPbdz1k4jXcHhsY7WWpSrlHzw== X-Received: by 2002:a05:6402:12d3:: with SMTP id k19mr57255854edx.244.1639331522759; Sun, 12 Dec 2021 09:52:02 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id jz4sm4627189ejc.19.2021.12.12.09.52.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 09:52:02 -0800 (PST) Message-ID: <8bd5bb15-906c-6682-0f50-394fbc2a4a15@enterprisedb.com> Date: Sun, 12 Dec 2021 18:52:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: extended stats on partitioned tables Content-Language: en-US To: Zhihong Yu Cc: Justin Pryzby , Jaime Casanova , PostgreSQL-development 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> <20211203052411.GU17618@telsasoft.com> <8052505e-2dd2-e8cb-26c9-cbb5dff7d750@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 12/12/21 16:37, Zhihong Yu wrote: > > Hi, > For patch 1, minor comment: > > +           if (planner_rt_fetch(onerel->relid, root)->inh) > > Since the rte (RangeTblEntry*) doesn't seem to be used beyond checking > inh, I think it would be better if the above style of checking is used > throughout the patch (without introducing rte variable). > It's mostly a matter of personal taste, but I always found this style of condition (i.e. dereferencing a pointer returned by a function) much less readable. It's hard to parse what exactly is happening, what struct type are we dealing with, etc. YMMV but the separate variable makes it much clearer for me. And I'd expect the compilers to produce pretty much the same code too for those cases. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company