Hi friends,
can someone help me in tuning the following query
both trans_tab and tax_tab have more than 180 million rows
and partition by hash, but the partition column is not present
is the query
Code:
insert into summ
select /*+ full(b) parallel (b,4)*/
a.srce_code, a.dest_code,
a.file_seq_no, a.filename, a.rec_type,
count(*) as rec_no, sum(a.charge) as charge,
sum(a.chargeable_units) as chargeable_units,
sum(b.tax) as tax
from (Select /*+ full(t) parallel(t, 4)*/
srce_code, dest_code, file_seq_no, filename,
rec_type, rec_no, sum(charge) as charge,
sum(chargeable_units) as chargeable_units
from trans_tab t
Where ((t.rec_type != 75 or (t.rec_type = 75 and
t.recentity_listno = 1))
and (t.charge_type = '00' or
t.charge_type is null or t.charge_type = ' '))
group by srce_code,dest_code, file_seq_no,
filename, rec_type, rec_no)a, tax_tab b
where a.filename = b.filename and
a.rec_type = b.rec_type and
a.rec_no = b.rec_no
group by a.srce_code, a.dest_code,
a.file_seq_no, a.filename, a.rec_type
The above query executes as follows
1)Fetches all the data from trans_tab parallelely
2)SORT/MERGE join for grouping
3)Fetches all the data from tax_tab parallelely
4)SORT the result set
5)Hash join the on both result set
I watched above execution through OEM