[Fwd: Re: [PERFORM] Seq scan on zero-parameters function] - Mailing list pgsql-sql

From Tomasz Myrta
Subject [Fwd: Re: [PERFORM] Seq scan on zero-parameters function]
Date
Msg-id 40234227.7060209@klaster.net
Whole thread Raw
List pgsql-sql
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




pgsql-sql by date:

Previous
From: "Mona H. Kapadia"
Date:
Subject: unsubscribe
Next
From: Tomasz Myrta
Date:
Subject: Re: [PERFORM] Seq scan on zero-parameters function