Advertisement

12.27.2005 at 01:59AM PST, ID: 21675963
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Huge performance difference between direct sql text execution and stored procedure execution

Asked by myrat in Oracle Database

Tags: , ,

Hi All,

I have a stored procedure (in a package) which contains only 1 query string. If I execute the string directly in SQL*+, it finishes in 2~3 minutes. But if I execute the stored procedure, it takes 30 minutes!

Here is the stored procedure:

*****************************
PROCEDURE PR_LOADEVE(
      in_FROM_DATE IN DATE,
      in_TO_DATE IN DATE,
      out_RET_CODE OUT INT
)
AS
        USD CHAR(3) := '001';
  SGD CHAR(3) := '022';
BEGIN
      out_RET_CODE := 0;
      -- CTR
      INSERT INTO DC_EVE_CTR (
            SELECT JOB_ID, E.VALUATION_DATE, E.CLIENT_CODE, SECURITY_ID, SUM(MKT_VAL3), SUM(MKT_VAL2), SUM(MKT_VAL1)
            FROM EVE.VIEW_EVE_VAL_CTR_JOB E,
            (SELECT VALUATION_DATE, CLIENT_CODE, MAX(JOB_ID) MAX_JOB_ID FROM EVE.VIEW_EVE_VAL_CTR_JOB E1
            WHERE VALUATION_DATE BETWEEN in_FROM_DATE AND in_TO_DATE
            GROUP BY VALUATION_DATE, CLIENT_CODE) E1
            WHERE E.VALUATION_DATE BETWEEN in_FROM_DATE AND in_TO_DATE
            AND E.VALUATION_DATE = E1.VALUATION_DATE
            AND E.CLIENT_CODE = E1.CLIENT_CODE
            AND E.JOB_ID = E1.MAX_JOB_ID
            GROUP BY SECURITY_ID, E.VALUATION_DATE, E.CLIENT_CODE, JOB_ID
      );

      out_RET_CODE := 1;
END;

*****************************
you can ignore the USD and SGD as they are just two constants.

When I execute the stored proc, I use
*****************************
DECLARE
  IN_FROM_DATE DATE;
  IN_TO_DATE DATE;
  OUT_RET_CODE NUMBER;

BEGIN
  IN_FROM_DATE := '30-Apr-2004';
  IN_TO_DATE := '30-Apr-2004';
  OUT_RET_CODE := NULL;

  DPMS.PKG_DPMSCHECKS.PR_LOADEVE ( IN_FROM_DATE, IN_TO_DATE, OUT_RET_CODE );
  COMMIT;
END;
****************************

It takes 30+ minutes.

and here is the query text that I executed in sql*+:

****************************
INSERT INTO DC_EVE_CTR (
      SELECT JOB_ID, E.VALUATION_DATE, E.CLIENT_CODE, SECURITY_ID, SUM(MKT_VAL3), SUM(MKT_VAL2), SUM(MKT_VAL1)
      FROM EVE.VIEW_EVE_VAL_CTR_JOB E,
            (SELECT VALUATION_DATE, CLIENT_CODE, MAX(JOB_ID) MAX_JOB_ID FROM EVE.VIEW_EVE_VAL_CTR_JOB E1
            WHERE VALUATION_DATE BETWEEN '30-Apr-2004' AND '30-Apr-2004'
            GROUP BY VALUATION_DATE, CLIENT_CODE) E1
      WHERE E.VALUATION_DATE BETWEEN '30-Apr-2004' AND '30-Apr-2004'
      AND E.VALUATION_DATE = E1.VALUATION_DATE
      AND E.CLIENT_CODE = E1.CLIENT_CODE
      AND E.JOB_ID = E1.MAX_JOB_ID
      GROUP BY SECURITY_ID, E.VALUATION_DATE, E.CLIENT_CODE, JOB_ID
);

****************************

and it takes only less than 3 minutes.

Any help is highly appreciated.Start Free Trial
[+][-]12.27.2005 at 02:15AM PST, ID: 15554745

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 02:53AM PST, ID: 15554816

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 03:29AM PST, ID: 15554882

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 06:02AM PST, ID: 15555627

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 08:22AM PST, ID: 15556365

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 02:52PM PST, ID: 15558951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 05:24PM PST, ID: 15559859

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 05:29PM PST, ID: 15559890

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.27.2005 at 06:46PM PST, ID: 15560321

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.28.2005 at 06:34AM PST, ID: 15562492

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.28.2005 at 09:13AM PST, ID: 15563753

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.28.2005 at 05:57PM PST, ID: 15567865

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.29.2005 at 03:16AM PST, ID: 15569741

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.02.2006 at 01:53PM PST, ID: 15593965

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 14-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01.06.2006 at 09:57AM PST, ID: 15631455

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: between, sql, difference
Sign Up Now!
Solution Provided By: PashaMod
Participating Experts: 7
Solution Grade: B
 
 
 
Loading Advertisement...
20081112-EE-VQP-43