Re: 14.1 immutable function, bad performance if check number = 'NaN' - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: 14.1 immutable function, bad performance if check number = 'NaN'
Date
Msg-id CAKFQuwYxhRcyYDWiaoEPmQR06FDTbSr=P_mdMKaviLL-O19=4Q@mail.gmail.com
Whole thread Raw
In response to Re: 14.1 immutable function, bad performance if check number = 'NaN'  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Monday, April 25, 2022, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Federico Travaglini <federico.travaglini@aubay.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.


Its the comparison of the double input value to the untyped literal ‘NaN’ (the first case test).

David J.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: 14.1 immutable function, bad performance if check number = 'NaN'
Next
From: Merlin Moncure
Date:
Subject: Re: 14.1 immutable function, bad performance if check number = 'NaN'