Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Set Arithmetic
Set arithmetic is a fine thing but is used much too seldom. Example of SQL optimizing course: Instead of
select c1
from t1
where c1 not in (
select c2 from t2 where c1 = c2
you may try
select c1
from t1
minus
select c2
from t2
which may be faster even without indexes by magnitudes. A few general hints:
(
select distinct c1 from t1 minus select c2 from t2
instead of
select distinct c1
from t1
minus (
select c2 from t2 union all select c3 from t3
Which one is faster heavily depends on your datasets.
execute dbms_utility.analyze_schema (schema => 'TESTUSER', method => 'ESTIMATE
STATISTICS', estimate_percent => 1)
execute dbms_utility.analyze_schema (schema => 'TESTUSER', method => 'ESTIMATE
STATISTICS', estimate_percent => 1, method_opt => 'FOR TABLE FOR ALL INDEXED
COLUMNS SIZE 254')
before doing huge queries and after doing heavy changes.
Martin Haltmayer
Lawrence wrote:
>
> I am writing an application which is having to, unvoidably use a lot of set
> arithmetic (UNION, INTERSET, MINUS) with large numbers of rows.
>
> Has nayone got any experience of doing this.. I haven't had the opportunity
> to test the system with a large volume of data as yet and I am a bit
> concerned about the likely performance impact of set operations...
>
> Does anyone have any tips & tricks for optimising such any application? I
> have increased my SORT_AREA_SIZE to 1 MB and this seems to be okay with my
> small datasets..
>
> Any help would be most appreciated..
>
> Thanks
> Lawrence
Received on Thu Feb 12 1998 - 00:00:00 CST
![]() |
![]() |