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

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Federico Travaglini <federico.travaglini@aubay.it>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2022-04-25T19:06:25Z
Lists: 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.