|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
help with optimizing query - please help
hello
please help me optimize this query as soon as you can, causing lot of performance issues. thanks, spk2003 select A.xpr_num xpr_num, D.bill_cd bill_cd, B.abbr_cd abbr_cd, B.ctg_num ctg_num, B.hth_cd hth_cd, C.due_key_id due_key_id, sum(C.actn_ct) actn_ct from PR_AG A, PRM_CV B, PRM_FAC C, BILL_FM D where A.PR_AG_KEYID = C.PR_AG_KEYID and B.PRM_CV_KEYID = C.PRM_CV_KEYID and D.bill_cd_keyid = C.bill_cd_keyid AND A.xpr_num = '01222' and due_key_id = (SELECT MAX(due_key_id) from PR_AG AA, PRM_CV BB, PRM_FAC CC, BILL_FM DD where AA.PR_AG_KEYID = CC.PR_AG_KEYID AND BB.PRM_CV_KEYID =CC.PRM_CV_KEYID AND DD.bill_cd_keyid = CC.bill_cd_keyid AND A.xpr_num = AA.xpr_num and D.bill_cd=DD.bill_cd AND B.abbr_cd=BB.abbr_cd) group by A.xpr_num, bill_cd, abbr_cd, ctg_num, hth_cd, due_key_id; |
|
#2
|
|||
|
|||
|
indexing????
1. Do you have indexes on all of the columns in your where clause? See your dba about this, as you'll need to come up with the best indexing strategy for you environment. (things like...Oracle reccomends <= 4 indexes per table).
2. why not just do select MAX(due_key_id) in the 1st select and eliminate the sub query? |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > help with optimizing query - please help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|