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 1jNzXE-0005QI-4r for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 13:54:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNzXB-0007c4-RV for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 13:53:57 +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 1jNzXB-0007bx-Kb for pgsql-hackers@lists.postgresql.org; Mon, 13 Apr 2020 13:53:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNzX4-00050M-OQ for pgsql-hackers@lists.postgresql.org; Mon, 13 Apr 2020 13:53:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03DDrkUI022915; Mon, 13 Apr 2020 09:53:46 -0400 From: Tom Lane To: Richard Guo cc: Konstantin Knizhnik , Thomas Munro , Alvaro Herrera , Pg Hackers Subject: Re: weird hash plan cost, starting with pg10 In-reply-to: References: <20200323165059.GA24950@alvherre.pgsql> <18131.1584982859@sss.pgh.pa.us> <4751e4df-5f98-657e-fb88-c039dd1e7a31@postgrespro.ru> <31321.1586549487@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Mon, 13 Apr 2020 17:07:41 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22913.1586786026.1@sss.pgh.pa.us> Date: Mon, 13 Apr 2020 09:53:46 -0400 Message-ID: <22914.1586786026@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Richard Guo writes: > At first I was wondering if we need to check whether HashState.hashtable > is not NULL in ExecShutdownHash() before we decide to allocate save > space for HashState.hinstrument. And then I convinced myself that that's > not necessary since HashState.hinstrument and HashState.hashtable cannot > be both NULL there. Even if the hashtable is null at that point, creating an all-zeroes hinstrument struct is harmless. regards, tom lane