Solved

optimize oracle query

Posted on 2012-12-29
7
444 Views
Last Modified: 2012-12-31
Hello,

How can I optimize the query insert into tr1234566_tmp_calc VALUES
         (:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:p11,:p12,:p13,:p14,:p15,:p
         16,:p17)  :
   Recommendation 1: SQL Tuning
   Estimated benefit is .28 active sessions, 10.88% of total activity.
   -------------------------------------------------------------------

         insert into tr1234566_tmp_calc VALUES
         (:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:p11,:p12,:p13,:p14,:p15,:p
         16,:p17)
   Rationale
      The SQL spent 98% of its database time on CPU, I/O and Cluster waits.
      This part of database time may be improved by the SQL Tuning Advisor.
   Rationale
      Database time for this SQL was divided as follows: 99% for SQL
      execution, 1% for parsing, 0% for PL/SQL execution and 0% for Java
      execution.
   Rationale
      SQL statement with SQL_ID "f79cfu8cpyg1b" was executed 464908 times and
      had an average elapsed time of 0.0063 seconds.

Thanks

bibi
0
Comment
Question by:bibi92
7 Comments
 
LVL 14

Expert Comment

by:ajexpert
ID: 38729641
Are you purely going by recommendations OR you are really experiencing performance issues with these insert statements?
0
 

Author Comment

by:bibi92
ID: 38729822
by recommendation.
0
 
LVL 23

Expert Comment

by:David
ID: 38730090
Off the top, inserts are commonly optimized with:
add the hint +APPEND so that writes at made at the high-water mark
parallelize the database writers
disable indexes for the load, and rebuild them after the commit
update the table statistics for the cost-based optimizer
find a compromise on how oftern you need to commit vs load on your redo log buffers
with a half-million rows, you are presumably scheduling this to a minimal-impact window (after hours)

As always, your actual results will vary.
0
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.

 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 38730197
Usually, inserts like this don't need any special tuning.  But, what is the time period for these half a million rows to be inserted?  What else is going on in the database at the time?  Can you combine these inserts to be multiple row inserts?  If yes, it may make sense to try the "append" hint.  But, there are some disadvantages to this approach.
0
 
LVL 14

Expert Comment

by:ajexpert
ID: 38730205
I suggest just don't follow recommendation unless you experience performance issue.  As suggested by other experts, Inserts do not need special tuning unless millions of records are being inserted.
0
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
ID: 38732408
I take this from you original post:

had an average elapsed time of 0.0063 seconds.

What do you expect to improve?

This is a bound statement and the plan is being repeatedly reused.  I don't see any problem with the statement at all.  It is showing up on a report because it exceeds a threshold, but the reason that it exceeds a threshold is that it has been run so many times.
0
 

Author Closing Comment

by:bibi92
ID: 38733100
Thanks regards bibi
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

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…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

773 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