Solved

How to create a sql profile

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
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.

895 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

15 Experts available now in Live!

Get 1:1 Help Now