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

From: Ashish Mittal <mittalashish_at_yahoo.com>
Date: Sun, 17 Feb 2002 08:31:10 GMT
Message-ID: <iTJb8.75447$AV5.376151_at_rwcrnsc51.ops.asp.att.net>


Well, one way to have the function evaluated last would be to do

select * from
(
select * from <tables> where <normal where clauses> )
where permission_p(param_column)

However, I think it is EXTREMELY rare for this to be needed. Can you PLEASE examine whether the permissions_P can be made a part of the sql. Can you post the full code of permissions_p

Ashish
"Dirk Gomez" <usenet_at_dirkgomez.de> wrote in message news: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 Sun Feb 17 2002 - 09:31:10 CET

Original text of this message