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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Emre Hasegeli <emre(at)hasegeli(dot)com>, nospam-pg-abuse(at)bloodgate(dot)com, Amit Langote <amitlangote09(at)gmail(dot)com>, 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-12 19:32:44
Message-ID: 20200212193244.xgcr6ghzrnajme5k@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2020-02-12 14:18:30 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I do wonder if we're just punching ourselves in the face with the
> > signature of these checks. Part of the problem here really comes from
> > using the same function to handle a number of different checks.
>
> Yeah, I've thought that too. It's *far* from clear that this thing
> is a win at all, other than your point about the number of copies of
> the ereport call. It's bulky, it's hard to optimize, and I have
> never thought it was more readable than the direct tests it replaced.
>
> > For most places it'd probably end up being easier to read and to
> > optimize if we just wrote them as
> > if (unlikely(isinf(result)) && !isinf(arg))
> > float_overflow_error();
> > and when needed added a
> > else if (unlikely(result == 0) && arg1 != 0.0)
> > float_underflow_error();
>
> +1

Cool. Emre, any chance you could write a patch along those lines?

I'm inclined that we should backpatch that, and just leave the inline
function (without in core callers) in place in 12?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-02-12 19:50:29 Re: In PG12, query with float calculations is slower than PG11
Previous Message Tom Lane 2020-02-12 19:18:30 Re: In PG12, query with float calculations is slower than PG11