Re: PL/SQL functions in SQL where clauses - how to evaluate them as a late as possible

From: Dirk Gomez <usenet_at_dirkgomez.de>
Date: 15 Feb 2002 09:56:00 -0800
Message-ID: <c8a033bd.0202150955.34d721bf_at_posting.google.com>


Hi Adrian,

no the SQL statement in the PL/SQL function is pretty much tuned. It works amazingly quick.

What hurts is that the PL/SQL function in the where clause usually is the _least_ selective predicate and I want it to be evaluated as late as possible. But even when I do stuff like:

select * from (
  select field1, field2, expensive_sql_function(param1,param2) as result
  from ...
  )
  where result='t';

the optimizer seems to rearrange my statement to compute expensive_sql_function very early during the process.

I tried "associate statistics" with high costs and/or low selectivity. And I tried the ORDERED_PREDICATE hint. But both for no avail.

cheers Dirk Received on Fri Feb 15 2002 - 18:56:00 CET

Original text of this message