"Josh Berkus" <josh@agliodbs.com> writes:
>> I don't understand the distinction you're trying to make here. In
>> general, a view column that is implemented as a function will give
>> the
>> optimizer headaches if you refer to it in WHERE --- the simplicity or
>> complexity of the function has got nothing to do with that AFAICS.
> OK. I thought that I noticed a difference between simple SQL functions
> and PL/pgSQL functions in this respect, but I could easily be mistaken.
AFAIR, the optimizer doesn't pay any attention at all to the
implementation language of a function. The only thing that comes to
mind here is that some care has been taken to mark all the built-in
functions as "iscachable" (or not, as appropriate); but user-created
functions may not be so marked when they should be, leading to loss of
performance in some cases.
regards, tom lane