Re: Invalid optimization of VOLATILE function in WHERE clause?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <ktm(at)rice(dot)edu>,"David Johnston" <polobo(at)yahoo(dot)com>
Cc: "'Florian Schoppmann'" <Florian(dot)Schoppmann(at)emc(dot)com>, "'Robert Haas'" <robertmhaas(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>,"'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Invalid optimization of VOLATILE function in WHERE clause?
Date: 2012-09-19 20:54:08
Message-ID: 5059EAA0020000250004A533@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David Johnston" <polobo(at)yahoo(dot)com> wrote:

>> | VOLATILE indicates that the function value can change even
>> | within a single table scan, so no optimizations can be made.
>> | Relatively few database functions are volatile in this sense;
>> | some examples are random(), [...]

> What are the arguments against adding a 4th identifier - call it
> PER_ROW for this argument? The main reason VOLATILE is broken is
> that it is the default and in order to minimize beginner's penalty
> it is not treated as such in some situations. The new one could
> behave just like VOLATILE but would never be optimized away and
> would always evaluate once for each row in its context.

So how would you document that? It sounds like the proposed level
would behave exactly as the VOLATILE level is currently documented
to behave; so I guess we could shift the documentation of VOLATILE
to PER_ROW (or whatever). How would you then describe the behavior
of VOLATILE?

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Johnston 2012-09-19 21:38:16 Re: Invalid optimization of VOLATILE function in WHERE clause?
Previous Message David Johnston 2012-09-19 20:40:18 Re: Invalid optimization of VOLATILE function in WHERE clause?