Re: In PG12, query with float calculations is slower than PG11

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Emre Hasegeli <emre(at)hasegeli(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, keisuke kuroda <keisuke(dot)kuroda(dot)3862(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: In PG12, query with float calculations is slower than PG11
Date: 2020-02-10 07:33:13
Message-ID: CA+HiwqFhXZU6-G+7YJuNk+NPOns=o=pOKvA-rZzGEsW_NEJPOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 7, 2020 at 11:43 PM Emre Hasegeli <emre(at)hasegeli(dot)com> wrote:
> > > The patch looks unduly invasive to me, but I think that it might be
> > > right that we should go back to a macro-based implementation, because
> > > otherwise we don't have a good way to be certain that the function
> > > parameter won't get evaluated first.
> >
> > I'd first like to see some actual evidence of this being a problem,
> > rather than just the order of the checks.
>
> There seem to be enough evidence of this being the problem. We are
> better off going back to the macro-based implementation. I polished
> Keisuke Kuroda's patch commenting about the performance issue, removed
> the check_float*_val() functions completely, and added unlikely() as
> Tom Lane suggested. It is attached. I confirmed with different
> compilers that the macro, and unlikely() makes this noticeably faster.

Thanks for updating the patch.

Should we update the same macro in contrib/btree_gist/btree_utils_num.h too?

Regards,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-02-10 07:58:56 pg_basebackup -F plain -R overwrites postgresql.auto.conf
Previous Message Craig Ringer 2020-02-10 07:20:32 Re: WAL usage calculation patch