Ishan Joshi, March 06, 2018 - 2:26 pm UTC
Thanks Chris for prompt Response.
We have mechanism to store the data in global temp table and this is the final insertion for GTT table. This mechanism was working fine for 2 yrs but it is getting issue from last 1 month onward.
1. can we use the nested loop for join as hash join will utilize memory and temp tablespace?
2. gather stats would help on GTT?
for merge hint, it is old code and we can neglect/remove the hint from the query as it is not impacting much to the execution plan if I remove the hint.
March 06, 2018 - 5:52 pm UTC
Rather than twiddling with the plan for this query, rethink the whole process.
Why are you staging the data in two GTTs before inserting to a third? Can you eliminate any of these GTTs? Why are you even using these at all?
divide and conquer
Racer I., March 07, 2018 - 10:55 am UTC
Hi,
guessing :
- the result should tell which N1 goes with which N2
- the current triple-join is hopefully unique
- the gtt2-table is quite big, so not so good to duplicate fully
so just insert N1/N2 (no c.*) combinations into gtt3 and join gtt2 and gtt3 (ON N2) again for the presumed fourth step.
or do everything in one SQL (maybe using WITH for good readability) as Chris suggested.
regards,
March 07, 2018 - 11:26 am UTC
Yep, breaking it up could help if this is possible.
Why not
Gh, March 07, 2018 - 6:36 pm UTC
Gtt3 is a specific copy of gtt2 within a N2 null from gtt1 when doesn't matches .
So a simple force view suffice for the need
Create or replace view gtt3 as ..