Solved

need help on explain plan oracle sql

Posted on 2014-03-10
3
499 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 37

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

777 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