Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 27th, 2004, 02:05 PM
spk2003 spk2003 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 spk2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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;

Reply With Quote
  #2  
Old May 2nd, 2004, 09:16 AM
jimbag8 jimbag8 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 28 jimbag8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > help with optimizing query - please help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway