Hi!Nope.
I'd like to know if this is expected behavior. These are two couples of queries. In each couple, the first one has a WHERE field = function() condition, just like the second one, but in the form WHERE field = (SELECT function()). In my opinion, both should have the same execution plan, as the function has no parameters and, therefore, is constant.
What would you say about function without params returning timeofday()? Is it constant?
If you are sure, that your function returns constant value - declare it as IMMUTABLE. (look at CREATE FUNCTION documentation)
Regards, Tomasz Myrta
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org