Home » RDBMS Server » Performance Tuning » How to Optimize the Query Without Using IN opertator
How to Optimize the Query Without Using IN opertator [message #509174] |
Thu, 26 May 2011 06:56 |
|
dhathri
Messages: 2 Registered: May 2011
|
Junior Member |
|
|
SELECT B.FRD_dd_ref_id,
B.FRD_dd_doc_id AS DD_document_id,
B.FRD_quest_flag,
B.FRD_ref_etal_ind,
A.DD_document_number,
A.DD_document_seq,
A.DD_record_type,
A.DD_alt_document_number,
A.DD_document_date,
A.DD_modified_date,
A.DD_document_type,
A.DD_input_document_type,
A.DD_amount,
A.DD_anr_flag,
A.DD_loan_type,
A.DD_quest_flag,
A.DD_title_company,
A.DD_remarks,
A.DD_retrieve_name_ind,
A.DD_skeleton_ref_flag,
A.DD_cmt_id,
A.DD_alt_cmt_id,
A.DD_fee_number
FROM NEO.AZ07.FCT_ref_document B,
NEO.AZ07.DIM_document A
WHERE B.FRD_dd_doc_id = @in_DdDocumentId AND B.FRD_dd_ref_id in (SELECT MAX(C.FRD_dd_ref_id) FROM NEO.AZ07.FCT_ref_document C, NEO.AZ07.DIM_document D WHERE C.FRD_dd_doc_id = @in_DdDocumentId AND D.DD_document_id=C.FRD_dd_ref_id GROUP BY D.DD_document_number) AND A.DD_document_id = B.FRD_dd_ref_id ORDER BY A.DD_document_date, A.DD_document_number, A.DD_document_seq
HI i want to optimize this query as it is taking 3 sec to execute i want to reduce its execution time is there any optimization to this query please advise
|
|
|
How to Optimize the Query Without Using IN opertator [message #509177 is a reply to message #509174] |
Thu, 26 May 2011 07:01 |
|
dhathri
Messages: 2 Registered: May 2011
|
Junior Member |
|
|
SELECT B.FRD_dd_ref_id,
B.FRD_dd_doc_id AS DD_document_id,
B.FRD_quest_flag,
B.FRD_ref_etal_ind,
A.DD_document_number,
A.DD_document_seq,
A.DD_record_type,
A.DD_alt_document_number,
A.DD_document_date,
A.DD_modified_date,
A.DD_document_type,
A.DD_input_document_type,
A.DD_amount,
A.DD_anr_flag,
A.DD_loan_type,
A.DD_quest_flag,
A.DD_title_company,
A.DD_remarks,
A.DD_retrieve_name_ind,
A.DD_skeleton_ref_flag,
A.DD_cmt_id,
A.DD_alt_cmt_id,
A.DD_fee_number
FROM NEO.AZ07.FCT_ref_document B,
NEO.AZ07.DIM_document A
WHERE B.FRD_dd_doc_id = @in_DdDocumentId
AND B.FRD_dd_ref_id in (SELECT MAX(C.FRD_dd_ref_id) FROM NEO.AZ07.FCT_ref_document C, NEO.AZ07.DIM_document D
WHERE C.FRD_dd_doc_id = @in_DdDocumentId AND D.DD_document_id=C.FRD_dd_ref_id
GROUP BY D.DD_document_number)
AND A.DD_document_id = B.FRD_dd_ref_id
ORDER BY A.DD_document_date,
A.DD_document_number,
A.DD_document_seq
|
|
|
|
Goto Forum:
Current Time: Tue Sep 17 16:35:36 CDT 2024
|