Hi,
I've the following function:
CREATE FUNCTION book_info(pricing) RETURNS catalog_general AS ' select * from catalog_general where star_isbn =
$1.vista_isbn' LANGUAGE 'sql';
calling it as: SELECT p.*, p.book_info.title FROM pricing p WHERE vista_ans='POD';
background and observation: the pricing table is fairly large, but only a small number meet "WHERE vista_ans='POD'". I
canselect all where vista_ans='POD' very quickly (.2 sec), but adding in the get_book(pricing) call slows this down to
about20sec. I can, with an external sql query, select all of the desired records in about 1 sec, so it appears to me
thatthe function is being called regardless of whether or not the WHERE clause is being satisfied.
question: is there any way the function call could be _not_ called if: 1) the WHERE clause does not reference any of
itsreturn values, and 2) the WHERE clause has already been satisified.
???
If this behavior is reasonable, could someone point me _toward_ the
code where I'd need to make this optimization. I think this would be
nice to have for 7.2 :)
brent