Solved

How to create a sql profile

Posted on 2014-07-30
8
217 Views
Last Modified: 2014-08-12
I have a long running sql which uses a view and was taking more than 20 minutes to  get the result.
I can able to fix this sql using a Parallel hint.(It is now giving the result in seconds). The issue is we can not change the code in the background.
How can I create a sql profile so that we need not to change the code?

The below sql is modified sql (Working) :-

select /*+ PARALLEL*/ * from ps_wklst_vw where order_num<250;

The Original sql was as follows:-
select  * from ps_wklst_vw where order_num<250;
0
Comment
Question by:Oranew
  • 5
  • 3
8 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40230540
Are you sure it was the parallel hint that made it faster or that the blocks were cached in memory from previous runs?

To get a true idea you need to flush the shared_pool, buffer_cache and depending on your version the result cache:

alter system flush shared_pool;
alter system flush buffer_cache;
exec dbms_result_cache.flush;

You need to think twice before doing this on a production system.

That said it looks like this might be what you are after but I cannot say for sure since I have never personally done it:
Example 17-4 Parallel Query Recommendation
http://docs.oracle.com/cd/E11882_01/server.112/e41573/sql_tune.htm#PFGRF95163
0
 

Author Comment

by:Oranew
ID: 40230609
Yes, I checked using the explain plan and I just need help with creating the sql profile using the above
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40230630
So are you saying the explain plan shows the same amount of disk/io parallel versus not parallel?
0
 

Author Comment

by:Oranew
ID: 40230731
I did not check the io but the cost is 2500 vs 35000
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 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40230745
The COST in an explain plan is worthless when it comes to performance.  It is a made up number.  Lower cost does not mean faster performance.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40230749
0
 

Author Closing Comment

by:Oranew
ID: 40255603
This is NOT a solution. Please close
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40255881
For a solution to the question asked, you need to continue working with the Experts.

I would have gladly continued working on this with you but you never posted back.
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…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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 video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

706 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

18 Experts available now in Live!

Get 1:1 Help Now