We help IT Professionals succeed at work.

Tuning the query based on the explain plan

gattu007
gattu007 asked
on
1,095 Views
Last Modified: 2013-12-19
I need to tune this below query

 select icl.facility_code, icl.document_tsn, icl.image_server_id, icl.path, ims.server_name, ims.path, ims.port, dt.patient_id, dt.file_format, dt.document_type, dt.document_extension, icl.CONTENT_TYPE, icl.ADMISSION_NUM, to_char(DT.SERVICE_DATE_TIME, 'MM/DD/YYYY'), ims.LOCAL_MOUNT_PATH, nvl(icl.zipped_y, 'N'), icl.master_exists from image_copy_location icl, image_server ims, document_txn dt where nvl(icl.deleted_yn, 'N') = 'N' and ims.server_name = '10.85.0.21' and ims.protocol = 'http' and ims.image_server_id = icl.image_server_id and icl.master_exists = 'N' and dt.document_tsn = icl.document_tsn and dt.facility_code = icl.facility_code and dt.file_format=25

Current explain plan
----------------------------
SELECT STATEMENT, GOAL = ALL_ROWS                  Cost=25651      Cardinality=103      Bytes=16892
 NESTED LOOPS                  Cost=25651      Cardinality=103      Bytes=16892
  NESTED LOOPS                  Cost=16758      Cardinality=4405      Bytes=577055
   TABLE ACCESS FULL      Object owner=NNA      Object name=IMAGE_SERVER      Cost=5      Cardinality=1      Bytes=62
   TABLE ACCESS BY INDEX ROWID      Object owner=NNA      Object name=IMAGE_COPY_LOCATION      Cost=16753      Cardinality=8830      Bytes=609270
    INDEX RANGE SCAN      Object owner=NNA      Object name=ICL_MASTER_IDX      Cost=249      Cardinality=35689      
  TABLE ACCESS BY INDEX ROWID      Object owner=NNA      Object name=DOCUMENT_TXN      Cost=2      Cardinality=1      Bytes=33
   INDEX UNIQUE SCAN      Object owner=NNA      Object name=XPKDOCUMENT_TXN      Cost=1      Cardinality=1      

Desired explain plan shown by EM Tuning adviser.  Can you pls let know what are the changes required to attain the below query
-------------------------
SELECT STATEMENT 0
 
 8 1 0.160 78234 939 4072929792 73802
HASH JOIN 1
 
 7 1 0.160 78234 939 4072929792 73802
TABLE ACCESS FULL 2 DOCUMENT_TXN TABLE 1 143982 4,640.045 35218 423 2640646656 32344
TABLE ACCESS BY INDEX ROWID 3 IMAGE_COPY_LOCATION TABLE 6 10278 692.561 9725 117 137806336 9575
NESTED LOOPS 4
 
 5 4672678 597,774.250 9727 117 137821056 9577
TABLE ACCESS BY INDEX ROWID 5 IMAGE_SERVER TABLE 3 1 0.061 2 1 14718 2
INDEX RANGE SCAN 6 IMG_SERV_IDX1 INDEX 2 1
 1 1 7321 1
INDEX RANGE SCAN 7 IMG_COPY_LOC_IDX1 INDEX 4 77353
 176 3 16596638 158
Comment
Watch Question

Database Administrator
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Forced accept.

Computer101
EE Admin

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.