Re: 14.1 immutable function, bad performance if check number = 'NaN'
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Federico Travaglini <federico.travaglini@aubay.it>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2022-04-25T19:03:32Z
Lists: pgsql-bugs
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. 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