Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Why performancediff package--direct query?
We have a fairly complicated view 'vy_leveranstid', but I don't think it's specification is relevant to my question.
If we execute a select count(*) in SQL*Worksheet it takes less than a second.
If we execute it as a packaged function it takes about 35 seconds.
Why? Anyone have a clue?
The function (part of leveranstabell package):
cantal_tider integer;
begin
select count(*)
into cantal_tider
from vy_leveranstid
where (butik_id=cbutik_id or cbutik_id is NULL)
and (lev_satt_id=clev_satt_id or clev_satt_id is NULL)
and (lev_adress_id=clevadress_id or clevadress_id is NULL);
return cantal_tider>0;
end har_transportor;
If we take the select, removes the into-clause and replaces the
cbutik_id,
clev_satt_id and clevadress_id with values
and executes the query, it takes less than a second,
if we do execute:
declare
i boolean;
begin
i := leveranstabell.har_leverantor(1,2,4711);
end;
it takes 35 seconds
Why?
regards
Göran