Обсуждение: [Fwd: Re: [PERFORM] Seq scan on zero-parameters function]

Поиск
Список
Период
Сортировка

[Fwd: Re: [PERFORM] Seq scan on zero-parameters function]

От
Tomasz Myrta
Дата:
Dnia 2004-02-06 08:19, Użytkownik Octavio Alvarez napisał:
> Hi!
> 
>    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.
Nope.

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