Solved

need help on explain plan oracle sql

Posted on 2014-03-10
3
490 Views
Last Modified: 2014-03-23
Hi ,

Iam new to sql tuning , I have been asked to run an explain plan for an query and provide possible solutions for tuning thehelp  query

I need help on reading and analyzing the explain plan, below is  the output of my plan table , any help in explaining the plan is very much appreciated.

Attached is   the  plan . Kindly help me in understanding the output.
sql1.txt
0
Comment
Question by:sam_2012
3 Comments
 
LVL 34

Assisted Solution

by:johnsone
johnsone earned 167 total points
ID: 39917185
In addition to the plan, the query would be very useful.

Based on the plan, you should be able to see that you are using no indexes at all.  As a first guess, I would be looking at putting an index on CONTACT.VISRES_ID.  You should also have indexes on all the join fields.

There also seems to be a lot of outer joins in your query.  Are those really necessary?
0
 
LVL 36

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 166 total points
ID: 39917205
you're basically selecting the first 25 rows from a view
there are no indexes used on any table as it's always a TABLE ACCESS FULL

my guess is there are no indexes on the table on the joined fields

in the explain plan: by optimizer calculations on stats
the rows column indicates how many rows of data will probably match that condition
the bytes indicates what volume this is

the TABLE ACCESS FULL indicates it has to read the complete table
> looks like you have a few million rows in each

the HASH JOIN indicates how the matching is done for each row

there are multiple times the same FULL table scan on the same tables
> CONTACT, USERDETAILS, CONTACTDETAILS, USERDETAILS_LOG ...
sometimes it's possible to avoid muliple reads on the same table by somewhat rewriting the query

without the query ... it's difficult to see that
0
 
LVL 6

Accepted Solution

by:
Javier Morales earned 167 total points
ID: 39917451
Yes,

the join with the view (24GB) really makes the cost raise up to 2Million cost units. You can see the time is going to 1minute 14seconds.

Here is the big cost. Check the filters on the view and make it use any indexes to make the 4 and half milion of rows of USERDETAILS lighten the weight.

Hope it helps.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now