Performance Query Tuning help [message #354265] |
Fri, 17 October 2008 04:37 |
rsoma
Messages: 15 Registered: April 2005 Location: Chennai, India
|
Junior Member |
|
|
Hi
i am using the following query and tables has more than 2-3 millions of record it is taking longer time around 10 mins to execute. can some one can help me out on refine the query.
Query:-
SELECT * FROM
DSS_LAST_EXTRACT, WORKFLOW_TASK wkt
WHERE
DSS_LAST_EXTRACT.EXTRACT_TABLE_NAME=$$TABLE_NAME
AND wkt.DW_EFFECT_DATE > DSS_LAST_EXTRACT.LAST_EXTRACT_DATE
AND wkt.DW_EFFECT_DATE < SYSDATE
and substr(wkt .workflow_task_name,1,1) <> '_'
and wkt .parent_workflow_task_id is not null
and wkt .parent_workflow_task_id <> '00'
and not exists (select root_workflow_task_id from workflow_job wfj where wfj.root_workflow_task_id = wkt .parent_workflow_task_id)
and wkt .ref_item_oid is not null
Explain Plan :-
ROWS Plan
7909 SELECT STATEMENT
7909 HASH JOIN ANTI
7909 NESTED LOOPS
1 TABLE ACCESS BY INDEX ROWID DSS_LAST_EXTRACT
1 INDEX UNIQUE SCAN PK_DSS_LAST_EXTRACT
7909 TABLE ACCESS BY INDEX ROWID WORKFLOW_TASK
29319 INDEX RANGE SCAN X9_WORKFLOW_TASK
342328 TABLE ACCESS FULL WORKFLOW_JOB
Thanks for your advice
Regards
Soma
|
|
|
|
|
|
Re: Performance Query Tuning help [message #354432 is a reply to message #354286] |
Sat, 18 October 2008 22:04 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
Run the following:
SELECT COUNT(*) FROM WORKFLOW_TASK
SELECT COUNT(*)
FROM DSS_LAST_EXTRACT, WORKFLOW_TASK wkt
WHERE DSS_LAST_EXTRACT.EXTRACT_TABLE_NAME=$$TABLE_NAME
AND wkt.DW_EFFECT_DATE > DSS_LAST_EXTRACT.LAST_EXTRACT_DATE
AND wkt.DW_EFFECT_DATE < SYSDATE
and substr(wkt .workflow_task_name,1,1) <> '_'
and wkt.parent_workflow_task_id is not null
and wkt.parent_workflow_task_id <> '00'
and wkt.ref_item_oid is not null
If the second SQL returns a number more than 10% of the first SQL, then you need to stop Oracle from performing the NESTED LOOPS join.
You might be able to do it with a CARDINALITY hint.
Run the SQLs and post the results.
Ross Leishman
|
|
|
Re: Performance Query Tuning help [message #354885 is a reply to message #354265] |
Tue, 21 October 2008 16:23 |
michael_bialik
Messages: 621 Registered: July 2006
|
Senior Member |
|
|
1. What columns are used in X9_WORKFLOW_TASK index (and what is their order)?
2. Do you have an index on WORKFLOW_JOB table with root_workflow_task_id as it's leading/first column?
-- If not - try to create one.
3. Can you rewrite the query as:
...
not exists (select 1 from workflow_job wfj where wfj.root_workflow_task_id = wkt .parent_workflow_task_id)
?
Michael
|
|
|
Re: Performance Query Tuning help [message #354896 is a reply to message #354885] |
Tue, 21 October 2008 22:27 |
rsoma
Messages: 15 Registered: April 2005 Location: Chennai, India
|
Junior Member |
|
|
Hi michael
for Q1 - having the index for the column parent_workflow_task_id
for Q2 - workflow_job is already having the index on root_workflow_task_id
for Q3 - let me try with the option. What could be the advantage by using this.
Thanks.
Regards
Soma
|
|
|