Re: check for null value before looking up the hash function

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: check for null value before looking up the hash function
Date: 2022-05-21 13:21:48
Message-ID: CAEudQArxiozRn12BBgbe9RGm8=toNG3GyJO4uoddamcDK5x8jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sáb., 21 de mai. de 2022 às 10:06, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:

> >Zhihong Yu <zyu(at)yugabyte(dot)com> writes:
> >> I was looking at the code in hash_record()
> >> of src/backend/utils/adt/rowtypes.c
> >> It seems if nulls[i] is true, we don't need to look up the hash
> function.
>
> >I don't think this is worth changing. It complicates the logic,
> >rendering it unlike quite a few other functions written in the same
> >style. In cases where the performance actually matters, the hash
> >function is cached across multiple calls anyway. You might save
> >something if you have many calls in a query and not one of them
> >receives a non-null input, but how likely is that?
>
> I disagree.
> I think that is worth changing. The fact of complicating the logic
> is irrelevant.
> But maybe the v2 attached would be a little better.
>
Or v3.

regards,
Ranier Vilela

Attachment Content-Type Size
v3-hash-record-check-null-first.patch application/octet-stream 2.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-05-21 13:38:06 Enforce "max_wal_size/ min_wal_size must be at least twice wal_segment_size" limit while setting GUCs
Previous Message Justin Pryzby 2022-05-21 13:09:22 doc: CREATE FOREIGN TABLE .. PARTITION OF .. DEFAULT