Solved

How to create a sql profile

Posted on 2014-07-30
8
225 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 77

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 77

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
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.

 

Author Comment

by:Oranew
ID: 40230731
I did not check the io but the cost is 2500 vs 35000
0
 
LVL 77

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 77

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 77

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.

Question has a verified solution.

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

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 shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

820 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