Re: STABLE functions
От | Joachim Wieland |
---|---|
Тема | Re: STABLE functions |
Дата | |
Msg-id | 20030425145007.GA26172@mcknight.de обсуждение исходный текст |
Ответ на | Re: STABLE functions (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: STABLE functions
|
Список | pgsql-hackers |
Hi Tom, On Fri, Apr 25, 2003 at 10:01:44AM -0400, Tom Lane wrote: > > I thought that this function is only executed once when declared as > > STABLE, > You are mistaken. > If you'd declared it IMMUTABLE, then it would get constant-folded, but > that may or may not be suitable for your purpose. The function in question is not IMMUTABLE :-( It depends on database lookups but won't change its results within one transaction. Quotation from the docs: | STABLE indicates that within a single table scan the function will | consistently return the same result for the same argument values, but | that ist result could change across SQL statements. So why is a SELECT ... FROM table WHERE col = f(...) (with a STABLE function f) not a "single table scan" or why does PostgreSQL re-calculate the value of f() here for every row? Thanks a lot, Joachim -- *****PGP key available - send e-mail request***** Due to circumstances beyond your control, you are master of your fate and captain of your soul.
В списке pgsql-hackers по дате отправления: