Re: [HACKERS] Function Volatility and Views Unexpected Behavior

2017-08-02 Thread Robert Haas
On Wed, Jul 12, 2017 at 3:23 PM, Tom Lane wrote: > David Kohn writes: >> I encountered some unexpected behavior when debugging a query that was >> taking longer than expected, basically, a volatile function that makes a >> column in a view is called even when that column is not selected in the >>

Re: [HACKERS] Function Volatility and Views Unexpected Behavior

2017-07-13 Thread David Kohn
Thanks for the reminder about explain verbose, that's helpful. But optimization does massively change the number of calls of a volatile function in a naive evaluation of a query: `explain analyze verbose select data1 from table1_silly_view where id >=10 and id <= 100;` does an index scan and onl

Re: [HACKERS] Function Volatility and Views Unexpected Behavior

2017-07-12 Thread Tom Lane
David Kohn writes: > I encountered some unexpected behavior when debugging a query that was > taking longer than expected, basically, a volatile function that makes a > column in a view is called even when that column is not selected in the > query, making it so that the function is called for eve

[HACKERS] Function Volatility and Views Unexpected Behavior

2017-07-12 Thread David Kohn
(Not sure whether I should be sending this to hackers or somewhere else, let me know if I should move, feel like I should say long time listener first time caller or something) I encountered some unexpected behavior when debugging a query that was taking longer than expected, basically, a volatile