Re: 14.1 immutable function, bad performance if check number = 'NaN'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Federico Travaglini <federico(dot)travaglini(at)aubay(dot)it>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: 14.1 immutable function, bad performance if check number = 'NaN'
Date: 2022-04-25 19:03:32
Message-ID: 116336.1650913412@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Federico Travaglini <federico(dot)travaglini(at)aubay(dot)it> writes:
> This funcion in used as a column in a select on about 400k records
> If I leave the highlighted row it takes 27 seconds, otherwise 14 seconds!
> Such behaviour looks not to be reasonable.

It's not at all clear which line you think is the "highlighted" one.

However, I'm guessing that this SQL function is a candidate for
inlining, so you might try comparing EXPLAIN VERBOSE output for
the query with both forms of the function. Perhaps that will
yield some insight into what's expensive.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-04-25 19:06:25 Re: 14.1 immutable function, bad performance if check number = 'NaN'
Previous Message Benjamin Leis 2022-04-25 16:58:15 Fwd: BUG #17467: Perf degradation after switching to latest jdbc drivers