Re: weird hash plan cost, starting with pg10

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: weird hash plan cost, starting with pg10
Date: 2020-04-14 01:50:39
Message-ID: CAMbWs4--CKO3PRrZGKbWLv-Hb3Ae-fB-rdpsva5sn6oAA3ncRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 13, 2020 at 9:53 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Richard Guo <guofenglinux(at)gmail(dot)com> 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.
>

Correct. The only benefit we may get from checking if the hashtable is
null is to avoid an unnecessary palloc0 for hinstrument. But that case
cannot happen though.

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-04-14 01:57:06 Re: relcache leak warnings vs. errors
Previous Message Tom Lane 2020-04-14 01:45:16 Re: 001_rep_changes.pl stalls