Re: Handle LIMIT/OFFSET before select clause (was: [HACKERS] Feature request: optimizer improvement)

2013-11-05 Thread Joe Love
I'm wondering what type of index would work for this as it is a volatile function. Not knowing how PGs optimizer runs, I'm at a loss as to why this wouldn't be possible or worth doing. It seems to me that all functions in the "select" part of the statement could be calculated at the end of the quer

[HACKERS] Feature request: optimizer improvement

2013-10-31 Thread Joe Love
In postgres 9.2 I have a function that is relatively expensive. When I write a query such as: select expensive_function(o.id),o.* from offeirng o where valid='Y' order by name limit 1; the query runs slow and appears to be running the function on each ID, which in this case should be totally unn

[HACKERS] Feature request: Optimizer improvement

2013-10-31 Thread Joe Love
In postgres 9.2 I have a function that is relatively expensive. When I write a query such as: select expensive_function(o.id),o.* from offeirng o where valid='Y' order by name limit 1; the query runs slow and appears to be running the function on each ID, which in this case should be totally unn