Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 528
  • Last Modified:

need help on explain plan oracle sql

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
sam_2012
Asked:
sam_2012
3 Solutions
 
johnsoneSenior Oracle DBACommented:
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
 
Geert GruwezOracle dbaCommented:
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
 
Javier MoralesOracle DBACommented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now