Parameters to be considered for tuning the QUERY Performance.

Hi Guys
I wanted to identify the Query which is taking more resources through the Dynamic performance views and not through OEM.I wanter to tune the Query.
Please suggest me on this. Also i wanted to know what are all the parameters to be considered for tuning a query like Query execution time, I/O Hits, Library cache hits, etc and from which performance view these paramaters can be taken. I also wanted to know how to find the size of library cache and how much queries can be holded in a library cache and what will be the retention of queries in library cache and how to retrive the queries from Library cache.
Thanks a lot
Edited by: user448837 on Sep 23, 2008 9:24 PM

Hmm there is a parameter called makemyquery=super_fast, check that ;-).
Ok jokes apart, your question is like asking a doctor that when a person is sick than how to troubleshoot his sickeness? So does a doctor start giving medicine immediately? No right? He has to check some symptoms of the patient. The same is applicable to the query also. There is no view as such which would tell you the performance of the query ie it is good or bad. Tell me if a query is taking up 5 minutes and I come and tell you this, what would you say its good or bad or the query took this much CPU time what would you say, its too much or too less? I am sure your answers would be "it depends". That's the key point.
The supermost point in the performance check is two things, one the plan of the query. What kind of plan optimizer took for the query and whether it was really good or not? There are millions os ways to do som ething but the idea is to do it in the best way. That's what the idea of reading explain plan. I would suggest get your self familiar with explain plan's various paths and their pros and cons. Also about the query's charectristics, you can check V$sql, v$sqlarea , V$sql_text views.
Your other question that you want to check the size of the library cache , its contents and the retention, I would say that its all internally managed. You never size library cache but shared pool only. Similary the best bet for a dba/developer is to check the queries are mostly shareable and there wont be any duplicate sqls. So the cursor_sharing parameter can be used for this. The control is not given to us to manage the rentention or the flushing of the queries from the cache.
HTH
Aman....

Similar Messages

  • Sql statement substituion - any special rules for formatting the query?

    Hey,
    I was wondering - are there any special rules for formatting the query that is to be substituted?
    I am asking, as somehow I am unable to make the DSP substitute my query. I took the basesql from the server console (to make sure that I have the correct version), configured a query substitution, and well, nothing happens.
    I've tried to substitute it with a modified version of the original query (where NVL(,0) is changed to NVL(,-9999)), then also with select * from dual (which I hope would generate some error), but DSP is ignoring everything...
    The query is rather big (400 lines), so maybe I need to format it somehow? I've noticed that in the docs (http://edocs.bea.com/aldsp/docs25/admin/server.html#wp1049919) that the query used in the example has all leading spaces removed. I've tried that, but DSP is still not doing any substitution...
    Any suggestions welcomed...
    Thanks,
    Leszek

    Michael,
    I am doing everything as in edocs, retrieving from logs the basesql (so with place holders). I've removed all new lines (so the query is now in a single line) and all excessive blanks (so all double/more blanks replaced with a single blank). Still the DSP is like ignoring the substitution. I've tried to do it even with a simple query, like:
    SELECT t4."PRODUCT_ID" AS c1, t4."PRODUCT_NAME" AS c2 FROM {DB}.{SELECTION} t1 JOIN {DB}.{CUSTOMER_FACT} t2 ON (t1."VAL" = t2."CUSTOMER_ID") JOIN {DB}.{CUSTOMER} t3 ON (t3."CUSTOMER_ID" = t2."CUSTOMER_ID") JOIN {DB}.{PRODUCT} t4 ON (t4."PRODUCT_ID" = t3."PRODUCT_ID") WHERE ((? = t1."SESSN_ID") AND (t1."NAME" = 'CUSTOMER_ID') AND (t3."DELET_DATE" IS NULL) AND (t3."PRODUCT_TYPE" = 11))
    am I missing something here? do I need to remove/add something , to make it work?
    I've tried removing blanks around = signs (which from the DSP pov results in a different query), sitll with no results.
    Edited by xnts at 06/24/2008 7:37 AM

  • How to improve the query performance

    ALTER PROCEDURE [SPNAME]
    @Portfolio INT,
    @Program INT,
    @Project INT
    AS
    BEGIN
    --DECLARE @StartDate DATETIME
    --DECLARE @EndDate DATETIME
    --SET @StartDate = '11/01/2013'
    --SET @EndDate = '02/28/2014'
    IF OBJECT_ID('tempdb..#Dates') IS NOT NULL
    DROP TABLE #Dates
    IF OBJECT_ID('tempdb..#DailyTasks') IS NOT NULL
    DROP TABLE #DailyTasks
    CREATE TABLE #Dates(WorkDate DATE)
    --CREATE INDEX IDX_Dates ON #Dates(WorkDate)
    ;WITH Dates AS
    SELECT (@StartDate) DateValue
    UNION ALL
    SELECT DateValue + 1
    FROM Dates
    WHERE DateValue + 1 <= @EndDate
    INSERT INTO #Dates
    SELECT DateValue
    FROM Dates D
    LEFT JOIN tb_Holidays H
    ON H.HolidayOn = D.DateValue
    AND H.OfficeID = 2
    WHERE DATEPART(dw,DateValue) NOT IN (1,7)
    AND H.UID IS NULL
    OPTION(MAXRECURSION 0)
    SELECT TSK.TaskID,
    TR.ResourceID,
    WC.WorkDayCount,
    (TSK.EstimateHrs/WC.WorkDayCount) EstimateHours,
    D.WorkDate,
    TSK.ProjectID,
    RES.ResourceName
    INTO #DailyTasks
    FROM Tasks TSK
    INNER JOIN TasksResource TR
    ON TSK.TaskID = TR.TaskID
    INNER JOIN tb_Resource RES
    ON TR.ResourceID=RES.UID
    OUTER APPLY (SELECT COUNT(*) WorkDayCount
    FROM #Dates
    WHERE WorkDate BETWEEN TSK.StartDate AND TSK.EndDate)WC
    INNER JOIN #Dates D
    ON WorkDate BETWEEN TSK.StartDate AND TSK.EndDate
    -------WHERE TSK.ProjectID = @Project-----
    SELECT D.ResourceID,
    D.WorkDayCount,
    SUM(D.EstimateHours/D.WorkDayCount) EstimateHours,
    D.WorkDate,
    T.TaskID,
    D.ResourceName
    FROM #DailyTasks D
    OUTER APPLY (SELECT (SELECT CAST(TaskID AS VARCHAR(255))+ ','
    FROM #DailyTasks DA
    WHERE D.WorkDate = DA.WorkDate
    AND D.ResourceID = DA.ResourceID
    FOR XML PATH('')) AS TaskID) T
    LEFT JOIN tb_Project PRJ
    ON D.ProjectID=PRJ.UID
    INNER JOIN tb_Program PR
    ON PRJ.ProgramID=PR.UID
    INNER JOIN tb_Portfolio PF
    ON PR.PortfolioID=PF.UID
    WHERE (@Portfolio = -1 or PF.UID = @Portfolio)
    AND (@Program = -1 or PR.UID = @Program)
    AND (@Project = -1 or PRJ.UID = @Project)
    GROUP BY D.ResourceID,
    D.WorkDate,
    T.TaskID,
    D.WorkDayCount,
    D.ResourceName
    HAVING SUM(D.EstimateHours/D.WorkDayCount) > 8
    hi..
    My SP is as above..
    I connected this SP to dataset in SSRS report..as per my logic..Portfolio contains many Programs and Program contains many Projects.
    When i selected the ALL value for parameters Program and Project..i'm unable to get output.
    but when i select values for all 3 parameters i'm getting output. i took default values for paramters also.
    so i commented the where condition in SP as shown above
    --------where TSK.ProjectID=@Project-------------
    now i'm getting output when selecting ALL value for parameters.
    but here the issue is performance..it takes 10sec to retrieve for single project when i'm executing the sp.
    how can i create index on temp table in this sp and how can i improve the query performance..
    please help.
    thanks in advance..
    lucky

    Didnt i provide you solution in other thread?
    ALTER PROCEDURE [SPNAME]
    @Portfolio INT,
    @Program INT,
    @Project INT
    AS
    BEGIN
    --DECLARE @StartDate DATETIME
    --DECLARE @EndDate DATETIME
    --SET @StartDate = '11/01/2013'
    --SET @EndDate = '02/28/2014'
    IF OBJECT_ID('tempdb..#Dates') IS NOT NULL
    DROP TABLE #Dates
    IF OBJECT_ID('tempdb..#DailyTasks') IS NOT NULL
    DROP TABLE #DailyTasks
    CREATE TABLE #Dates(WorkDate DATE)
    --CREATE INDEX IDX_Dates ON #Dates(WorkDate)
    ;WITH Dates AS
    SELECT (@StartDate) DateValue
    UNION ALL
    SELECT DateValue + 1
    FROM Dates
    WHERE DateValue + 1 <= @EndDate
    INSERT INTO #Dates
    SELECT DateValue
    FROM Dates D
    LEFT JOIN tb_Holidays H
    ON H.HolidayOn = D.DateValue
    AND H.OfficeID = 2
    WHERE DATEPART(dw,DateValue) NOT IN (1,7)
    AND H.UID IS NULL
    OPTION(MAXRECURSION 0)
    SELECT TSK.TaskID,
    TR.ResourceID,
    WC.WorkDayCount,
    (TSK.EstimateHrs/WC.WorkDayCount) EstimateHours,
    D.WorkDate,
    TSK.ProjectID,
    RES.ResourceName
    INTO #DailyTasks
    FROM Tasks TSK
    INNER JOIN TasksResource TR
    ON TSK.TaskID = TR.TaskID
    INNER JOIN tb_Resource RES
    ON TR.ResourceID=RES.UID
    OUTER APPLY (SELECT COUNT(*) WorkDayCount
    FROM #Dates
    WHERE WorkDate BETWEEN TSK.StartDate AND TSK.EndDate)WC
    INNER JOIN #Dates D
    ON WorkDate BETWEEN TSK.StartDate AND TSK.EndDate
    WHERE (TSK.ProjectID = @Project OR @Project = -1)
    SELECT D.ResourceID,
    D.WorkDayCount,
    SUM(D.EstimateHours/D.WorkDayCount) EstimateHours,
    D.WorkDate,
    T.TaskID,
    D.ResourceName
    FROM #DailyTasks D
    OUTER APPLY (SELECT (SELECT CAST(TaskID AS VARCHAR(255))+ ','
    FROM #DailyTasks DA
    WHERE D.WorkDate = DA.WorkDate
    AND D.ResourceID = DA.ResourceID
    FOR XML PATH('')) AS TaskID) T
    LEFT JOIN tb_Project PRJ
    ON D.ProjectID=PRJ.UID
    INNER JOIN tb_Program PR
    ON PRJ.ProgramID=PR.UID
    INNER JOIN tb_Portfolio PF
    ON PR.PortfolioID=PF.UID
    WHERE (@Portfolio = -1 or PF.UID = @Portfolio)
    AND (@Program = -1 or PR.UID = @Program)
    AND (@Project = -1 or PRJ.UID = @Project)
    GROUP BY D.ResourceID,
    D.WorkDate,
    T.TaskID,
    D.WorkDayCount,
    D.ResourceName
    HAVING SUM(D.EstimateHours/D.WorkDayCount) > 8
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to improve the query performance in to report level and designer level

    How to improve the query performance in to report level and designer level......?
    Plz let me know the detail view......

    first its all based on the design of the database, universe and the report.
    at the universe Level, you have to check your Contexts very well to get the optimal performance of the universe and also your joins, keep your joins with key fields, will give you the best performance.
    at the report level, try to make the reports dynamic as much as you can, (Parameters) and so on.
    and when you create a paremeter try to get it match with the key fields in the database.
    good luck
    Amr

  • Having more LTSs in logical dimension table hit the query performance?

    Hi,
    We have a logical table having around 19 LTSs. Having more LTSs in logical dimension table hit the query performance?
    Thanks,
    Anilesh

    Hi Anilesh,
    Its kind of both YES and NO. Here is why...
    NO:
    LTS are supposed to give BI Server an optimistic and logical way to retrieve the data. So, having more Optimistic LTS might help the BI Server with some good options tailored to a variety of analysis requests.
    YES:
    Many times, we have to bring in multiple physical tables as a part of single LTS (Mostly when the physical model is a snowflake) which might cause performance issues. Say there is a LTS with two tables "A" and "B", but for a ad-hoc analysis just on columns in "A", the query would still include the join with table "B" if this LTS is being used. We might want to avoid this kind of situations with multiple LTS each for a table and one for both of them.
    Hope this helps.
    Thank you,
    Dhar

  • Tuning the query : Very Urgent

    Hi
    We have query wich needs tuning.when we are putting REGULAR EXPRESSION query is running fine but whne we put like LIKE stmt it is taking time.Here is the query below.Please help on tuning.
    SELECT a.order_number, b.last_update_date,TO_CHAR( b.split_percent,'FM99999.009') SPLIT_PERCENTAGE,
    rs.NAME " SALES_PERSON_NAME ", rs.salesrep_number, b.effective_date,
    b.creation_date "CREATION_DATE", rt.NAME "TERRITORY_NAME",
    rt.segment1 "ERP_CODE", a.booked_date "DATE_BOOKED",
    TO_CHAR(ROUND((( (SELECT SUM (ordered_quantity * unit_selling_price)
    FROM apps.oe_order_lines_all ol
    WHERE ol.header_id = a.header_id)
    * b.split_percent
    / 100
    ) , 2),'FM99999999999999999999.009') order_total ,
    (SELECT user_name
    FROM fnd_user
    WHERE user_id = b.last_updated_by) requested_by,
    b.obsolete_date
    FROM oe_order_headers_all a,
    apps.csm_header_sales_cr_hist b,
    jtf_rs_salesreps rs,
    ra_territories rt
    WHERE 1 = 1
    AND a.header_id = b.source_header_id
    AND b.territory_id = rt.territory_id
    AND b.salesrep_id = rs.salesrep_id
    AND b.source_type = 'O'
    AND a.order_number IN (
    SELECT a.order_number
    FROM oe_order_headers_all a,
    apps.csm_header_sales_cr_hist b,
    jtf_rs_salesreps rs,
    ra_territories rt
    WHERE 1 = 1
    AND a.header_id = b.source_header_id
    AND b.territory_id = rt.territory_id
    AND b.salesrep_id = rs.salesrep_id
    AND b.source_type = 'O'
    -- AND b.obsolete_date IS NULL --ommented by andondap as per TD#9648 Changes
    AND  REGEXP_LIKE ( rs.name , '(svc)|(Muti.*Y)|(Multi.*Y)|(._MY)')  Commented by andondap as per TD#9648 Changes
    AND b.last_update_date BETWEEN TO_DATE ('2012/11/25', 'YYYY/MM/DD') AND TO_DATE ('2013/03/23', 'YYYY/MM/DD')+ 0.9999
    AND REGEXP_LIKE ( rs.name,'(.MY)|(Muti.*Y))|(Multi.*Y)|(._MY) |(mlti)')
    AND rs.name LIKE '%SVC%MULTI%' OR rs.name NOT LIKE '%DUMMY%' OR rs.name LIKE 'Svc%Multi%' OR rs.name LIKE 'Svc%MY%'
    OR rs.name LIKE 'Service%Multi%' OR rs.name LIKE '%MY_SHARE_TM' OR rs.name LIKE '%MY_SHARE_T')
    ORDER BY a.order_number, b.creation_date
    Thanks
    Hibin

    Hmmm, let's see...
    1. OP provided formatted code using {noformat}{noformat} tags.... - FAILED
    2. OP provided database version in full... - FAILED
    3. OP provided table structures and index information... - FAILED
    4. OP provided cardinality and selectivity information... - FAILED
    5. OP provided explain plans... - FAILED
    6. OP provided execution traces... - FAILED
    7. OP is a new member and can be excused for above failures... - FAILED
    8. OP has asked previous questions and followed forum etiquette by marking them as answered... - FAILED
    9. OP has respected volunteers and other questioners by not marking his question as Urgent... - FAILED
    10. OP has read the forum FAQ ({message:id=9360002}) for posting his question...  - FAILED
    11. OP has read the forum FAQ ({message:id=9360003}) for posting a tuning question... - FAILED
    It's a good job you're not a computer program, you wouldn't have even compiled.
    so, points to note:
    This is a forum of volunteers.  There's no such thing as an Urgent question here, and it's considered rude to suggest your question is urgent, as that indicates you want immediate attention from the people who are giving up their own time to help, and who have their own jobs to do.  It's also rude for the other people who are asking questions, as everyone would like an answer to their problem as soon as possible, so what makes you any more special?  An urgent issue is one where a live system is down potentially putting people's lives at risk or causing a company to lose money, or somehow damage their services.  Such issues should be logged with Oracle Support, not on the free OTN forums.
    Next, when you post your question, ensure you provide all the information that is needed for people to be able to help you.  Read the FAQ posts which point to useful threads indicating what information is required, especially for tuning requests.
    Finally, when your questions have been answered, it is common courtesy to mark them as answered (and award points if appropriate), otherwise it indicates that you have no respect for the people who are helping you.
    If you follow all the advice above, you will end up creating a good question that people will be willing to help you with.   If you don't follow the advice above, such as in this question you've posted, you will find that few experts will bother to help (or if they post it will not likely be helpful advise you receive).  The choice is yours.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Please help!!! Tuning the query

    Hi,
    I am using Oracle BDBXML 2.4.16. In the following, policyContainer.dbxml has around 1000 documents and productsContainer.dbxml around 10 documents. The following query is taking around 6 - 8 seconds to fetch the data of around 300 records. I have created node-element-equality-string indexes on PolicyEvent, PolicyStatus, Archived, IsLatest, ProductID and CompanyID.
    I am novice on Query tuning. Can someone please help me to tune the following query. I have posted the query plan as well.
    Thanks in Advance!!
    Balakrishna.
    Query:
    query ' for $policy in collection("policyContainer.dbxml")/Policy[PolicyState/PolicyEvent=("APPLICATION","QUOTE","BINDER","POLICY","ENDORSEMENT QUOTE")]
    [PolicyHeader/ProductID = (for $product in collection("productsContainer.dbxml")/Product/ProductsHeader[CompanyID=(1)] return $product/ProductID)]
    [PolicyState/PolicyStatus !=("RATE","DECLINED ENDORSEMENT QUOTE","DECLINED NON-PRE ENDORSEMENT QUOTE","DECLINED EXTENSION QUOTE")]
    [PolicyState/Archived !="true"]
    [(PolicyState/IsLatest !="false"
    and (PolicyState/PolicyStatus != ("ENDORSEMENT QUOTE","NON-PRE ENDORSEMENT QUOTE","EXTENSION QUOTE")))
    or (PolicyState/IsLatest !="true"
    and (PolicyState/PolicyStatus =("ENDORSEMENT QUOTE","NON-PRE ENDORSEMENT QUOTE","EXTENSION QUOTE")))]
    let $state := $policy/PolicyState 
    let $header := $policy/PolicyHeader
    let $datatable := $policy/DataTable/DataTableInfo
    return
    <policyDetail>
    {$policy/SubmissionNumber},
    {$policy/DocumentNumber},
    {$policy/QuoteVersionNumber},
    {$state/*,$header/*,$datatable/*}
    </policyDetail>'
    Query plan:
    <XQuery>
      <Return>
        <LetTuple uri="" name="datatable">
          <LetTuple uri="" name="header">
            <LetTuple uri="" name="state">
              <ForTuple uri="" name="policy">
                <ContextTuple/>
                <QueryPlanToAST>
                  <BufferQP id="2">
                    <NegativeNodePredicateFilterQP uri="" name="#tmp67">
                      <NegativeNodePredicateFilterQP uri="" name="#tmp73">
                        <NodePredicateFilterQP uri="" name="#tmp404">
                          <ParentOfChildJoinQP>
                            <StepQP axis="parent-of-child" name="PolicyState" nodeType="element">
                              <UnionQP>
                                <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="ENDORSEMENT QUOTE"/>
                                <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="APPLICATION"/>
                                <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="POLICY"/>
                                <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="BINDER"/>
                                <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="QUOTE"/>
                              </UnionQP>
                            </StepQP>
                            <StepQP axis="child" name="Policy" nodeType="element">
                              <SequentialScanQP container="policyContainer.dbxml" nodeType="document"/>
                            </StepQP>
                          </ParentOfChildJoinQP>
                          <ValueFilterQP comparison="eq" general="true">
                            <StepQP axis="child" name="ProductID" nodeType="element">
                              <StepQP axis="child" name="PolicyHeader" nodeType="element">
                                <VariableQP name="#tmp404"/>
                              </StepQP>
                            </StepQP>
                            <Atomize>
                              <Return>
                                <ForTuple uri="" name="product">
                                  <ContextTuple/>
                                  <QueryPlanToAST>
                                    <ParentOfChildJoinQP>
                                      <ValueFilterQP comparison="eq" general="true">
                                        <PresenceQP container="productsContainer.dbxml" index="node-element-equality-string" operation="prefix" child="CompanyID"/>
                                        <Sequence>
                                          <NumericTypeConstructor value="1.0E0" typeuri="http://www.w3.org/2001/XMLSchema" typename="integer"/>
                                        </Sequence>
                                      </ValueFilterQP>
                                      <StepQP axis="child" name="ProductsHeader" nodeType="element">
                                        <StepQP axis="child" name="Product" nodeType="element">
                                          <SequentialScanQP container="productsContainer.dbxml" nodeType="document"/>
                                        </StepQP>
                                      </StepQP>
                                    </ParentOfChildJoinQP>
                                  </QueryPlanToAST>
                                </ForTuple>
                                <QueryPlanToAST>
                                  <StepQP axis="child" name="ProductID" nodeType="element">
                                    <VariableQP name="product"/>
                                  </StepQP>
                                </QueryPlanToAST>
                              </Return>
                            </Atomize>
                          </ValueFilterQP>
                        </NodePredicateFilterQP>
                        <ValueFilterQP comparison="ne" general="true">
                          <ValueFilterQP comparison="ne" general="true">
                            <ValueFilterQP comparison="ne" general="true">
                              <ValueFilterQP comparison="ne" general="true">
                                <StepQP axis="child" name="PolicyStatus" nodeType="element">
                                  <StepQP axis="child" name="PolicyState" nodeType="element">
                                    <VariableQP name="#tmp73"/>
                                  </StepQP>
                                </StepQP>
                                <Sequence>
                                  <AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                  <AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                  <AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                  <AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                </Sequence>
                              </ValueFilterQP>
                              <Sequence>
                                <AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                <AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                <AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                <AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              </Sequence>
                            </ValueFilterQP>
                            <Sequence>
                              <AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              <AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              <AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              <AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            </Sequence>
                          </ValueFilterQP>
                          <Sequence>
                            <AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            <AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            <AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            <AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                          </Sequence>
                        </ValueFilterQP>
                      </NegativeNodePredicateFilterQP>
                      <ChildJoinQP>
                        <StepQP axis="child" name="PolicyState" nodeType="element">
                          <VariableQP name="#tmp67"/>
                        </StepQP>
                        <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="Archived" value="true"/>
                      </ChildJoinQP>
                    </NegativeNodePredicateFilterQP>
                    <UnionQP>
                      <NegativeNodePredicateFilterQP uri="" name="#tmp18">
                        <NegativeNodePredicateFilterQP uri="" name="#tmp46">
                          <BufferReferenceQP id="2"/>
                          <ChildJoinQP>
                            <StepQP axis="child" name="PolicyState" nodeType="element">
                              <VariableQP name="#tmp46"/>
                            </StepQP>
                            <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="IsLatest" value="false"/>
                          </ChildJoinQP>
                        </NegativeNodePredicateFilterQP>
                        <ValueFilterQP comparison="ne" general="true">
                          <ValueFilterQP comparison="ne" general="true">
                            <ValueFilterQP comparison="ne" general="true">
                              <StepQP axis="child" name="PolicyStatus" nodeType="element">
                                <StepQP axis="child" name="PolicyState" nodeType="element">
                                  <VariableQP name="#tmp18"/>
                                </StepQP>
                              </StepQP>
                              <Sequence>
                                <AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                <AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                                <AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              </Sequence>
                            </ValueFilterQP>
                            <Sequence>
                              <AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              <AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                              <AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            </Sequence>
                          </ValueFilterQP>
                          <Sequence>
                            <AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            <AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                            <AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
                          </Sequence>
                        </ValueFilterQP>
                      </NegativeNodePredicateFilterQP>
                      <NegativeNodePredicateFilterQP uri="" name="#tmp56">
                        <ParentOfChildJoinQP>
                          <StepQP axis="parent-of-child" name="PolicyState" nodeType="element">
                            <UnionQP>
                              <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="NON-PRE ENDORSEMENT QUOTE"/>
                              <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="EXTENSION QUOTE"/>
                              <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="ENDORSEMENT QUOTE"/>
                            </UnionQP>
                          </StepQP>
                          <BufferReferenceQP id="2"/>
                        </ParentOfChildJoinQP>
                        <ChildJoinQP>
                          <StepQP axis="child" name="PolicyState" nodeType="element">
                            <VariableQP name="#tmp56"/>
                          </StepQP>
                          <ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="IsLatest" value="true"/>
                        </ChildJoinQP>
                      </NegativeNodePredicateFilterQP>
                    </UnionQP>
                  </BufferQP>
                </QueryPlanToAST>
              </ForTuple>
              <QueryPlanToAST>
                <StepQP axis="child" name="PolicyState" nodeType="element">
                  <VariableQP name="policy"/>
                </StepQP>
              </QueryPlanToAST>
            </LetTuple>
            <QueryPlanToAST>
              <StepQP axis="child" name="PolicyHeader" nodeType="element">
                <VariableQP name="policy"/>
              </StepQP>
            </QueryPlanToAST>
          </LetTuple>
          <QueryPlanToAST>
            <StepQP axis="child" name="DataTableInfo" nodeType="element">
              <StepQP axis="child" name="DataTable" nodeType="element">
                <VariableQP name="policy"/>
              </StepQP>
            </StepQP>
          </QueryPlanToAST>
        </LetTuple>
        <DOMConstructor type="element">
          <Name>
            <Sequence>
              <ATQNameConstructor uri="" prefix="" localname="policyDetail" typeuri="http://www.w3.org/2001/XMLSchema" typename="QName"/>
            </Sequence>
          </Name>
          <Children>
            <ContentSequence>
              <QueryPlanToAST>
                <StepQP axis="child" name="SubmissionNumber" nodeType="element">
                  <VariableQP name="policy"/>
                </StepQP>
              </QueryPlanToAST>
            </ContentSequence>
            <ContentSequence>
              <Sequence>
                <AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
              </Sequence>
            </ContentSequence>
            <ContentSequence>
              <QueryPlanToAST>
                <StepQP axis="child" name="DocumentNumber" nodeType="element">
                  <VariableQP name="policy"/>
                </StepQP>
              </QueryPlanToAST>
            </ContentSequence>
            <ContentSequence>
              <Sequence>
                <AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
              </Sequence>
            </ContentSequence>
            <ContentSequence>
              <QueryPlanToAST>
                <StepQP axis="child" name="QuoteVersionNumber" nodeType="element">
                  <VariableQP name="policy"/>
                </StepQP>
              </QueryPlanToAST>
            </ContentSequence>
            <ContentSequence>
              <Sequence>
                <AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
              </Sequence>
            </ContentSequence>
            <ContentSequence>
              <Parenthesized>
                <QueryPlanToAST>
                  <ChildJoinQP>
                    <VariableQP name="state"/>
                    <SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>
                  </ChildJoinQP>
                </QueryPlanToAST>
                <QueryPlanToAST>
                  <StepQP axis="child" uri="*" name="*" nodeType="element">
                    <VariableQP name="header"/>
                  </StepQP>
                </QueryPlanToAST>
                <QueryPlanToAST>
                  <ChildJoinQP>
                    <VariableQP name="datatable"/>
                    <SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>
                  </ChildJoinQP>
                </QueryPlanToAST>
              </Parenthesized>
            </ContentSequence>
          </Children>
        </DOMConstructor>
      </Return>
    </XQuery>

    The good news is that your indexes are being used (anywhere in the query plan where you see index="node-element-equality-string"), the bad news is that the entire policyContainer is being scanned several times (<SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>). Your best bet is to upgrade to dbxml-2.5.16, since that has several improvements to the optimizer that should optimize away those scans. Failing that, use the shell command (dbxml) to add and remove indexes and see how that changes the query plan and speed. The following line is what is causing the scans:
    {$state/*,$header/*,$datatable/*}So add indexes that will help to locate those nodes, or change that line so that the query is faster.
    Lauren Foutz

  • Parameters to be considered for functional specification preparation

    hello experts
    what are the parameters need to be considered at the time of prep.of any functional specification for abap deveopment?
    or how to prepare functional spec

    It depends on how you design your specification -
    for example for creation of notification & order in the back ground you can use BAPI
    For creation of confirmation of order you can use BAPI.
    Use T code BAPI for exploring the available  BAPI & their uses.
    For finding out  user exit use t- code SE84.
    enhancements - serch with IW* you will get all PM related exits
    For function module use SE37 for searching function modules
    As such its upto the ABAPer to use them in development
    Shakti

  • BSW% is not considered for correcting the transactional quantity

    I  solicit a little help from the Group. We have a Crude Vendor  which is also in SAP platform . They have implemeted TSW and now Crude delivery tickets are generated from System.
    On scrutinty of ticket It is observed taht BS&W percentage is not considered while calulating quantities in Transaction UOM.
    Transaction code : O3QCITEST.
    Conv. Group = ZCDR.=53&54A 15 °C CRUDE OIL
    UoM Group = CRD.=L/L15/KG/BB6
    Transaction Quantity = 100 L.
    Material temp = 30 deg-C
    Test temp = 15 Deg-C
    Test relative density = 870 KGV.
    With the above data if you put BSW% = 0, then additional quantities calculated are 0.622 BB6, 85.938 KG, 98.779 L15 , 100 L.
    if you put BSW% = 0.5, then additional quantities are 0.618 BB6, 85.508
    KG, 98.285 L15 , 100 L.
    From above it is clear that the additional quantities in all units except in "L" change whenever the BSW% changes. This shows that BSW% is not considered in calculating the "L" quantity.
    In actual practice BSW correction should happen for Transactional Quantity also.
    If you have any solution for the above scenarion . please suggest.for necessary correction.
    regards
    Dipak
    [email protected]

    Dear Vishnu
    You r right . Standard SAP behaves that way only. We modified badi OIB_QCI_ROUND_QTY
    method: IF_EX_OIB_QCI_ROUND_QTY~ROUND_QTY
    coding atatched.
    Anyway thanks for reply.
    METHOD IF_EX_OIB_QCI_ROUND_QTY~ROUND_QTY .
    Local Data
      TYPES: T_CTPARAM TYPE OIB_A10,
             T_ADQNT TYPE OIB_A05.
      DATA:  S_CTPARAM TYPE OIB_A10,
             S_ADQNT  TYPE OIB_A05,
             S_ADQNTN TYPE OIB_A05.
      DATA : L_BSW(72) TYPE C.
      DATA: W_PAR_FLTP TYPE OIB_A10-PAR_FLTP,
            WF_BSW     TYPE OIB_A10-PAR_FLTP .
      DATA: IT_PARAM  TYPE STANDARD TABLE OF T_CTPARAM,
            IT_ADQNT  TYPE STANDARD TABLE OF T_ADQNT,
            IT_ADQNTN TYPE STANDARD TABLE OF T_ADQNT.
      DATA: W_TABIX TYPE SY-TABIX.
      DATA:  W_DIMENSION TYPE  T006-DIMID,
             W_TEXT      TYPE  T006T-TXDIM,
             W_MEINS     TYPE  T006-MSEHI ,
             L_MENGE     TYPE  MLEA-MEINH ,
             WA_PARAM    TYPE  OIB_A10 .
    *-----DATA DECLARATION FOR L15 START -
      DATA : WF_ADQNT_L     TYPE  OIB_A05-ADQNT,
             WF_ADQNT_L15   TYPE  OIB_A05-ADQNT,
             WF_ADQNT_TMP   TYPE  OIB_A05-ADQNT,
             WF_ADQNT_ROUND TYPE  OIB_A05-ADQNT,
             WF_ADQNT_KG    TYPE  OIB_A05-ADQNT.
    *-----DATA DECLARATION FOR L15 END -
      IT_ADQNT = TC_QT2TAB.
      READ TABLE ITC_PARAM INTO S_CTPARAM WITH KEY FIELDNAME = 'UMRSL'.
      IF SY-SUBRC = 0 AND S_CTPARAM-PAR_CHAR = 'ZCRD' .   "’ .   "AMP
        READ TABLE ITC_PARAM INTO S_CTPARAM WITH KEY FIELDNAME = 'MEINH'.
        W_MEINS = S_CTPARAM-PAR_CHAR.
        IF W_MEINS NE SPACE.
          CALL FUNCTION 'DIMENSION_GET_FOR_UNIT'
            EXPORTING
              LANGUAGE       = SY-LANGU
              UNIT           = W_MEINS
            IMPORTING
              DIMENSION      = W_DIMENSION
              TEXT           = W_TEXT
            EXCEPTIONS
              UNIT_NOT_FOUND = 1
              OTHERS         = 2.
        ENDIF.
        IF W_DIMENSION = 'VOLUME'.
          READ TABLE ITC_PARAM INTO S_CTPARAM
            WITH KEY FIELDNAME = 'BSWCN'.
          WF_BSW = S_CTPARAM-PAR_FLTP .
          READ TABLE IT_ADQNT INTO S_ADQNT WITH KEY MSEHI = 'MT' MANEN = ' '.
          IF SY-SUBRC = 0.
            W_TABIX = SY-TABIX.
            S_ADQNT-ADQNT =
                    S_ADQNT-ADQNT * ( 1 -  ( S_CTPARAM-PAR_FLTP / 100 ) ).
            MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.
            TC_QT2TAB  = IT_ADQNT.
          ENDIF.
          READ TABLE IT_ADQNT INTO S_ADQNT WITH KEY MSEHI = 'KG' MANEN = ' '.
          IF SY-SUBRC = 0.
            W_TABIX = SY-TABIX.
            S_ADQNT-ADQNT =
                    S_ADQNT-ADQNT * ( 1 -  ( S_CTPARAM-PAR_FLTP / 100 ) ).
            MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.
            TC_QT2TAB  = IT_ADQNT.
          ENDIF.
    *-----Start BSW% in Litre Qty----
          READ TABLE IT_ADQNT INTO S_ADQNT WITH KEY MSEHI = 'L' MANEN = ' '.
          IF SY-SUBRC = 0.
            W_TABIX = SY-TABIX.
            S_ADQNT-ADQNT =
                   S_ADQNT-ADQNT * ( 1 -  ( S_CTPARAM-PAR_FLTP / 100 ) ).
            WF_ADQNT_L  = S_ADQNT-ADQNT .
            MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.
            TC_QT2TAB  = IT_ADQNT.
          ENDIF.
    *-----End BSW% in Litre Qty--
    *---L15 start----
          READ TABLE IT_ADQNT INTO S_ADQNT WITH KEY MSEHI = 'L15' MANEN = ' '.
          IF SY-SUBRC = 0.
            W_TABIX = SY-TABIX.
            WF_ADQNT_L15 = S_ADQNT-ADQNT .
            WF_ADQNT_TMP = ( WF_ADQNT_L15 / WF_ADQNT_L ).
            CALL FUNCTION 'ROUND'
              EXPORTING
                DECIMALS      = 4
                INPUT         = WF_ADQNT_TMP
                SIGN          = 'X'
              IMPORTING
                OUTPUT        = WF_ADQNT_ROUND
              EXCEPTIONS
                INPUT_INVALID = 1
                OVERFLOW      = 2
                TYPE_INVALID  = 3
                OTHERS        = 4.
            WF_ADQNT_L15   = WF_ADQNT_ROUND * WF_ADQNT_L .
            S_ADQNT-ADQNT = WF_ADQNT_L15 .
           MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.  " ---Blocked by Prasanta on 08-june-07
            MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.
            TC_QT2TAB  = IT_ADQNT.
          ENDIF.
    *---L15 end----
    *---KG start---
          READ TABLE IT_ADQNT INTO S_ADQNT WITH KEY MSEHI = 'KG' MANEN = ' '.
          IF SY-SUBRC = 0.
            W_TABIX = SY-TABIX.
            READ TABLE ITC_PARAM INTO S_CTPARAM
            WITH KEY FIELDNAME = 'BDICH'.
            WF_ADQNT_KG  = ( WF_ADQNT_L15 / ( 1 - ( WF_BSW / 100 ) ) * ( ( S_CTPARAM-PAR_FLTP / 1000 ) - 11 / 10000 ) ) - ( WF_ADQNT_L15 / ( 1 - ( WF_BSW / 100 ) ) * ( WF_BSW / 100 )  *  9979 / 10000  ) .
            S_ADQNT-ADQNT = WF_ADQNT_KG .
            MODIFY IT_ADQNT   FROM S_ADQNT INDEX W_TABIX TRANSPORTING ADQNT.
            TC_QT2TAB  = IT_ADQNT.
          ENDIF.
    *---KG end---
        ENDIF.
      ENDIF.
    ENDMETHOD.

  • Needs help for tuning the sql

    Hi
    I have a query which will read one fact table and 4 dimension table.fact table contains millions of records
    Can u suggest me how can i tune my query which uses the fact table to get the best performance.

    Which version of the database are you using? Have you enabled Star Transformation? What does the explain plan look like? Is this intended for building a materilaized view or as the basis for running an ad hoc report?
    We created bit map indexes on the joining columns.bitmap indexes or bitmap-join indexes?
    Cheers, APC

  • Tuning the query..

    Hi guys,
    I have written a demand view query which is working perfectly and is giving demand betnwen specified date range. Can you suggest any modification in the query which will tune it to run faster and improve performance:
    --Demand View query
    --Data to use
    --date: give any date range for this month
    SELECT calendar_date,man_days_demand,/*total_fsr_count,*/
    (total_fsr_count - MAN_DAYS_DEMAND) man_days_unstaffed,
    /*FSR_Assigned_Serv_Req , FSR_Assigned_OT_Req ,*/
    (total_fsr_count-(FSR_Assigned_Serv_Req + FSR_Assigned_OT_Req)) Man_days_avail
    FROM (
    SELECT TRUNC(cal.calendar_date) calendar_date,
    (-- in line column qry to count the service reqs falling on that specific day
    SELECT nvl(sum(count(ssrj.assigned_field_service_rep)),0)
    FROM sop_service_request_job ssrj, sop_service_request ssr
    WHERE (((cal.calendar_date between ssrj.scheduled_start_date AND
    get_end_date(ssrj.scheduled_start_date,
    ssrj.expected_service_hours,
    ssrj.weekend)))
    OR
    (cal.calendar_date < ssrj.scheduled_start_date and
    cal.calendar_date > get_end_date(ssrj.scheduled_start_date,
    ssrj.expected_service_hours,
    ssrj.weekend)))
    and ssrj.service_request_id = ssr.service_request_id
    and ssrj.assigned_field_service_rep is not null
    GROUP BY calendar_date
    ) Man_Days_demand,
    SELECT nvl(sum(count(ssrj.assigned_field_service_rep)),0)
    FROM sop_service_request_job ssrj, sop_service_request ssr
    WHERE (((cal.calendar_date between ssrj.scheduled_start_date AND
    get_end_date(ssrj.scheduled_start_date,
    ssrj.expected_service_hours,
    ssrj.weekend)))
    OR
    (cal.calendar_date < ssrj.scheduled_start_date and
    cal.calendar_date > get_end_date(ssrj.scheduled_start_date,
    ssrj.expected_service_hours,
    ssrj.weekend)))
    and ssrj.service_request_id = ssr.service_request_id
    and ssrj.assigned_field_service_rep is not null
    and ssrj.job_status = 'ASSIGNED'
    GROUP BY calendar_date
    ) FSR_Assigned_Serv_Req,
    select nvl(sum(count(fsr_sso_id)),0)
    from sop_other_time_alloc_det sotad
    where ((cal.calendar_date between trunc(sotad.start_date) AND
    trunc(sotad.end_date)) OR
    (cal.calendar_date < trunc(sotad.start_date) AND
    cal.calendar_date > trunc(sotad.end_date)))
    GROUP BY calendar_date
    ) FSR_Assigned_OT_Req,
    select nvl(count(distinct sso_id),0)
    from sop_user_map
    where role_id = 1
    ) total_fsr_count
    FROM sop_fiscal_calendar_v cal, sop_service_user ssu, sop_service_request ssr,
    sop_service_request_job ssrj, CSA_PLATFORM_MASTER cpm
    WHERE
    calendar_date BETWEEN trunc(to_date('&date_range_start_date','mm/dd/yyyy'))
    AND trunc(to_date('&date_range_end_date','mm/dd/yyyy'))
    and ssu.sso_id = ssrj.assigned_field_service_rep
    and ssrj.service_request_id = ssr.service_request_id
    and trim(ssu.sso_id) = trim('&ssoid')
    and upper(ssu.qualification) like upper('%&qualification%')
    and upper(cpm.platform_name) like upper('%&platform_name%')
    and upper(ssu.country) like upper('%&country%')
    and upper(ssr.region_id) like upper('%&region_id')
    and upper(ssrj.weekend) like upper('%&weekend%')
    and upper(ssu.state) like upper('%&state%')
    GROUP BY calendar_date
    ) order by calendar_date
    Thx,,
    JP

    Hello
    To preserve the formatting any text you post you need surround them with the UBB Code tags [pre] and [/pre]. i.e.
    [pre]
    SQL> select * from dual;
    D
    X
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE
       1    0   TABLE ACCESS (FULL) OF 'DUAL'
    Statistics
              0  recursive calls
              4  db block gets
              1  consistent gets
              0  physical reads
              0  redo size
            544  bytes sent via SQL*Net to client
            643  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processed
    [/pre]
    HTH
    David

  • Pls help me for tuning the querry

    Hi Team,
    Can any one help me to tune the query below.
    The table STG_INT_CASHFLOWS has 20 lahks record with index created for PAYMENTDATE,DEALNUMBER,PAYRECEIVEIND.
    Is there any other way like collecting into array and finding the values etc..
    SELECT '1'
    FROM STG_INT_CASHFLOWS
    WHERE PAYMENTDATE < :B4
    AND PAYMENTDATE > TO_CHAR (:B3, 'YYYYMMDD')
    AND DEALNUMBER = :B2
    AND PAYRECEIVEIND = :B1
    AND ROWNUM = 1
    Thanks.

    Logic of my code below.
    For test in(
    select * from STG_INT_CASHFLOWS ORDER BY dealnumber, payreceiveind, TO_DATE (TRIM (paymentdate), 'yyyymmdd')) Loop
    SELECT 0 into Varibale
    FROM STG_INT_CASHFLOWS
    WHERE PAYMENTDATE < test.PAYMENTDATE
    AND PAYMENTDATE > TO_CHAR (sysdate, 'YYYYMMDD')
    AND DEALNUMBER = test.dealnumber
    AND PAYRECEIVEIND = test.PAYRECEIVEIND
    AND ROWNUM = 1
    We have some other logice below and select statement used using the cursor values.
    End loop;
    But we face only performace issue with the main cursor with order by clause. But as per logic order by clause cannot be removed. we will use th select staement mentioned.

  • Tuning The Query By Using Xplain Plan

    Hi Guys,
    This particular query is taking a long time in the production reported by The SPE team .
    SELECT
    CASE
    WHEN TPJRCSHDRW1.CASH_DRAWER_ID = 5000555
    THEN 1
    WHEN TPTRJO1.OTHER_CASH_DRAWER_ID = 5000555
    THEN 2
    END TRADE_TYPE,
    TPDECO1.DENOMINATION_COUNT_ID,
    TPDECO1.DENOMINATION_CATEGORY,
    TPDECO1.DENOMINATION_VALUE,
    TPDECO1.DENOMINATION_COUNT,
    TPDECO1.DENOMINATION_TYPE,
    TPDECO1.DENOMINATION_NAME,
    TPTRJO1.TRANSACTION_ID,
    TPTRJO1.TOTAL_VALUE,
    TPTRJO1.TOTAL_VALUE_CCODE,
    TPTRJO1.JOURNAL_ENTRY_ID,
    TPJRCSHDRW1.CASH_DRAWER_ID,
    TPTRJO1.OTHER_CASH_DRAWER_ID
    FROM TRANSACTION_JOURNAL TPTRJO1
    INNER JOIN JOURNAL_CASH_DRAWER TPJRCSHDRW1
    ON TPTRJO1.JOURNAL_ENTRY_ID = TPJRCSHDRW1.JOURNAL_ENTRY_ID
    LEFT OUTER JOIN DENOMINATION_COUNT TPDECO1
    ON TPDECO1.JOURNAL_ENTRY_ID = TPJRCSHDRW1.JOURNAL_ENTRY_ID
    WHERE ((TPJRCSHDRW1.CASH_DRAWER_ID = 5000555)
    OR (TPTRJO1.OTHER_CASH_DRAWER_ID = 5000555))
    AND (TPTRJO1.TRANSACTION_ID IN (563,590,1362,605,562,589,604))
    AND (TPTRJO1.STATUS NOT IN ('I','V','R'))
    AND ((TPTRJO1.REVERSED_BY) IS NULL) AND (TPJRCSHDRW1.CASH_DRAWER_DATE >= to_date('2009-07-24','yyyy-mm-dd') )
    AND (TPTRJO1.TOTAL_VALUE <> 0)
    AND ((TPTRJO1.OFFSET_ID) IS NULL);
    When I am analysing the query by xplain_plan , I am getting this plan
    Plan hash value: 3371088438
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 36557 | 3391K| 1445 (1)| 00:00:18 |
    | 1 | CONCATENATION | | | | | |
    | 2 | NESTED LOOPS OUTER | | 1 | 95 | 3 (0)| 00:00:01 |
    | 3 | NESTED LOOPS | | 1 | 63 | 2 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| TRANSACTION_JOURNAL | 1 | 40 | 1 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | I26_TRANSACTION_JOURNAL | 1 | | 1 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER | 1 | 23 | 1 (0)| 00:00:01 |
    |* 7 | INDEX RANGE SCAN | PKC_JOURNAL_CASH_D | 1 | | 1 (0)| 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID | DENOMINATION_COUNT | 12 | 384 | 1 (0)| 00:00:01 |
    |* 9 | INDEX RANGE SCAN | PKC_DENOMINATION_COUNT | 20 | | 1 (0)| 00:00:01 |
    | 10 | NESTED LOOPS OUTER | | 36556 | 3391K| 1442 (1)| 00:00:18 |
    | 11 | NESTED LOOPS | | 1817 | 111K| 715 (0)| 00:00:09 |
    | 12 | TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER | 1817 | 41791 | 351 (0)| 00:00:05 |
    |* 13 | INDEX RANGE SCAN | SPE099_JOURNALCASHDRWR | 1817 | | 7 (0)| 00:00:01 |
    |* 14 | TABLE ACCESS BY INDEX ROWID| TRANSACTION_JOURNAL | 1 | 40 | 1 (0)| 00:00:01 |
    |* 15 | INDEX UNIQUE SCAN | PKC_TRANSACTION_JOURNAL | 1 | | 1 (0)| 00:00:01 |
    | 16 | TABLE ACCESS BY INDEX ROWID | DENOMINATION_COUNT | 20 | 640 | 1 (0)| 00:00:01 |
    |* 17 | INDEX RANGE SCAN | PKC_DENOMINATION_COUNT | 20 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - filter("TPTRJO1"."TOTAL_VALUE"<>0 AND "TPTRJO1"."REVERSED_BY" IS NULL AND
    "TPTRJO1"."OFFSET_ID" IS NULL)
    5 - access("TPTRJO1"."OTHER_CASH_DRAWER_ID"=5000555)
    filter("TPTRJO1"."STATUS"<>U'I' AND "TPTRJO1"."STATUS"<>U'V' AND "TPTRJO1"."STATUS"<>U'R'
    AND ("TPTRJO1"."TRANSACTION_ID"=562 OR "TPTRJO1"."TRANSACTION_ID"=563 OR
    "TPTRJO1"."TRANSACTION_ID"=589 OR "TPTRJO1"."TRANSACTION_ID"=590 OR
    "TPTRJO1"."TRANSACTION_ID"=604 OR "TPTRJO1"."TRANSACTION_ID"=605 OR
    "TPTRJO1"."TRANSACTION_ID"=1362))
    6 - filter("TPJRCSHDRW1"."DRAWER_SEQ" IS NOT NULL)
    7 - access("TPTRJO1"."JOURNAL_ENTRY_ID"="TPJRCSHDRW1"."JOURNAL_ENTRY_ID" AND
    "TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
    filter("TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd
    hh24:mi:ss'))
    9 - access("TPDECO1"."JOURNAL_ENTRY_ID"(+)="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
    13 - access("TPJRCSHDRW1"."CASH_DRAWER_ID"=5000555 AND
    "TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
    filter("TPJRCSHDRW1"."DRAWER_SEQ" IS NOT NULL)
    14 - filter("TPTRJO1"."STATUS"<>U'I' AND "TPTRJO1"."STATUS"<>U'V' AND "TPTRJO1"."STATUS"<>U'R'
    AND ("TPTRJO1"."TRANSACTION_ID"=562 OR "TPTRJO1"."TRANSACTION_ID"=563 OR
    "TPTRJO1"."TRANSACTION_ID"=589 OR "TPTRJO1"."TRANSACTION_ID"=590 OR
    "TPTRJO1"."TRANSACTION_ID"=604 OR "TPTRJO1"."TRANSACTION_ID"=605 OR
    "TPTRJO1"."TRANSACTION_ID"=1362) AND "TPTRJO1"."TOTAL_VALUE"<>0 AND "TPTRJO1"."REVERSED_BY" IS
    NULL AND "TPTRJO1"."OFFSET_ID" IS NULL AND LNNVL("TPTRJO1"."OTHER_CASH_DRAWER_ID"=5000555))
    15 - access("TPTRJO1"."JOURNAL_ENTRY_ID"="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
    17 - access("TPDECO1"."JOURNAL_ENTRY_ID"(+)="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
    --There is an index  SPE099_JOURNALCASHDRWR which is on
    CASH_DRAWER_ID
    CASH_DRAWER_DATE
    DRAWER_SEQ
    But I am wondering why there is TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER when this col is availabe in the indexed table .
    Can anyone Please suggest what improvements can be done on this query.WIll change in the table order will have some performance boost.
    Please suggest ..
    Thanks
    Prafulla

    Could you please execute your query reported here below (pay attention to the gather_plan_statistics hint)
    select /*+ gather_plan_statistics */
          case
            when tpjrcshdrw1.cash_drawer_id = 5000555
            then 1
            when tptrjo1.other_cash_drawer_id = 5000555
            then 2
          end trade_type,
          tpdeco1.denomination_count_id,
          tpdeco1.denomination_category,
          tpdeco1.denomination_value,
          tpdeco1.denomination_count,
          tpdeco1.denomination_type,
          tpdeco1.denomination_name,
          tptrjo1.transaction_id,
          tptrjo1.total_value,
          tptrjo1.total_value_ccode,
          tptrjo1.journal_entry_id,
          tpjrcshdrw1.cash_drawer_id,
          tptrjo1.other_cash_drawer_id
    from
          transaction_journal tptrjo1
    inner join journal_cash_drawer tpjrcshdrw1
            on tptrjo1.journal_entry_id = tpjrcshdrw1.journal_entry_id
    left outer join denomination_count tpdeco1
            on tpdeco1.journal_entry_id        = tpjrcshdrw1.journal_entry_id
    where ((tpjrcshdrw1.cash_drawer_id = 5000555)
          or (tptrjo1.other_cash_drawer_id   = 5000555))
    and (tptrjo1.transaction_id       in (563,590,1362,605,562,589,604))
    and (tptrjo1.status not           in ('I','V','R'))
    and ((tptrjo1.reversed_by)        is null)
    and (tpjrcshdrw1.cash_drawer_date >= to_date('2009-07-24','yyyy-mm-dd') )
    and (tptrjo1.total_value 0)
    and ((tptrjo1.offset_id) is null);and post the formatted explain plan you will get using
    select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));IS one of the following indexed columns NULLABLE?
    CASH_DRAWER_ID
    CASH_DRAWER_DATE
    DRAWER_SEQ
    Best Regards
    Mohamed Houri
    www.hourim.wordpress.com
    Edited by: Mohamed Houri on 14-juin-2012 7:07

  • How to improve the query performance or tune query from Explain Plan

    Hi
    The following is my explain plan for sql query. (The plan is generated by Toad v9.7). How to fix the query?
    SELECT STATEMENT ALL_ROWSCost: 4,160 Bytes: 25,296 Cardinality: 204                                         
         8 NESTED LOOPS Cost: 3 Bytes: 54 Cardinality: 1                                    
              5 NESTED LOOPS Cost: 2 Bytes: 23 Cardinality: 1                               
                   2 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 13 Cardinality: 1                          
                        1 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   4 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 10 Cardinality: 1                          
                        3 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cost: 1 Cardinality: 1                     
              7 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 31 Cardinality: 1                               
                   6 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cost: 1 Cardinality: 1                          
         10 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              9 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         15 NESTED LOOPS Cost: 2 Bytes: 29 Cardinality: 1                                    
              12 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                               
                   11 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                          
              14 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_ORDER_HEADERS_ALL Cost: 1 Bytes: 17 Cardinality: 1                               
                   13 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Cardinality: 1                          
         21 FILTER                                    
              16 TABLE ACCESS FULL TABLE ONT.OE_TRANSACTION_TYPES_TL Cost: 2 Bytes: 1,127 Cardinality: 49                               
              20 NESTED LOOPS Cost: 2 Bytes: 21 Cardinality: 1                               
                   18 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                          
                        17 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                     
                   19 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Bytes: 9 Cardinality: 1                          
         23 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1                                    
              22 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1                               
         45 NESTED LOOPS Cost: 4,160 Bytes: 25,296 Cardinality: 204                                    
              42 NESTED LOOPS Cost: 4,150 Bytes: 23,052 Cardinality: 204                               
                   38 NESTED LOOPS Cost: 4,140 Bytes: 19,992 Cardinality: 204                          
                        34 NESTED LOOPS Cost: 4,094 Bytes: 75,850 Cardinality: 925                     
                             30 NESTED LOOPS Cost: 3,909 Bytes: 210,843 Cardinality: 3,699                
                                  26 PARTITION LIST ALL Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18          
                                       25 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_HEADERS Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18     
                                            24 INDEX SKIP SCAN INDEX XLA.XLA_AE_HEADERS_N1 Cost: 264 Cardinality: 1,398,115 Partition #: 29 Partitions accessed #1 - #18
                                  29 PARTITION LIST ITERATOR Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32           
                                       28 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_LINES Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32      
                                            27 INDEX RANGE SCAN INDEX (UNIQUE) XLA.XLA_AE_LINES_U1 Cost: 1 Cardinality: 1 Partition #: 32
                             33 PARTITION LIST ITERATOR Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35                
                                  32 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_DISTRIBUTION_LINKS Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35           
                                       31 INDEX RANGE SCAN INDEX XLA.XLA_DISTRIBUTION_LINKS_N3 Cost: 1 Cardinality: 1 Partition #: 35      
                        37 PARTITION LIST SINGLE Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 38                     
                             36 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_EVENTS Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 39 Partitions accessed #2               
                                  35 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_EVENTS_U1 Cost: 1 Cardinality: 1 Partition #: 40 Partitions accessed #2          
                   41 PARTITION LIST SINGLE Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 41                          
                        40 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_TRANSACTION_ENTITIES Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 42 Partitions accessed #2                    
                             39 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_TRANSACTION_ENTITIES_U1 Cost: 1 Cardinality: 1 Partition #: 43 Partitions accessed #2               
              44 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 1 Bytes: 11 Cardinality: 1                               
                   43 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1

    damorgan wrote:
    Tuning is NOT about reducing the cost of i/o.
    i/o is only one of many contributors to cost and only one of many contributors to waits.
    Any time you would like to explore this further run this code:
    SELECT 1 FROM dual
    WHERE regexp_like(' ','^*[ ]*a');but not on a production box because you are going to experience an extreme tuning event with zero i/o.
    And when I say "extreme" I mean "EXTREME!"
    You've been warned.I think you just need a faster server.
    SQL> set autotrace traceonly statistics
    SQL> set timing on
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');
    no rows selected
    Elapsed: 00:00:00.00
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            243  bytes sent via SQL*Net to client
            349  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedRepeated from an Oracle 10.2.0.x instance:
    SQL> SELECT DISTINCT SID FROM V$MYSTAT;
           SID
           310
    SQL> ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    Session altered.
    SQL> select 1 from dual
      2  where
      3  regexp_like   (' ','^*[ ]*a');The session is hung. Wait a little while and connect to the database using a different session:
    COLUMN STAT_NAME FORMAT A35 TRU
    SET PAGESIZE 200
    SELECT
      STAT_NAME,
      VALUE
    FROM
      V$SESS_TIME_MODEL
    WHERE
      SID=310;
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0Seems to be using a bit of time for the hard parse (hard parse elapsed time). Wait a little while, then re-execute the query:
    STAT_NAME                                VALUE
    DB time                                   9247
    DB CPU                                    9247
    background elapsed time                      0
    background cpu time                          0
    sequence load elapsed time                   0
    parse time elapsed                        6374
    hard parse elapsed time                   5997
    sql execute elapsed time                  2939
    connection management call elapsed        1660
    failed parse elapsed time                    0
    failed parse (out of shared memory)          0
    hard parse (sharing criteria) elaps          0
    hard parse (bind mismatch) elapsed           0
    PL/SQL execution elapsed time               95
    inbound PL/SQL rpc elapsed time              0
    PL/SQL compilation elapsed time              0
    Java execution elapsed time                  0
    repeated bind elapsed time                  48
    RMAN cpu time (backup/restore)               0The session is not reporting additional CPU usage or parse time.
    Let's check one of the session's statistics:
    SELECT
      SS.VALUE
    FROM
      V$SESSTAT SS,
      V$STATNAME SN
    WHERE
      SN.NAME='consistent gets'
      AND SN.STATISTIC#=SS.STATISTIC#
      AND SS.SID=310;
         VALUE
           163Not many consistent gets after 20+ minutes.
    Let's take a look at the plan:
    SQL> SELECT SQL_ID,CHILD_NUMBER FROM V$SQL WHERE SQL_TEXT LIKE 'select 1 from du
    al%';
    SQL_ID        CHILD_NUMBER
    04mpgrzhsv72w            0
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('04mpgrzhsv72w',0,'TYPICAL'))
    select 1 from dual where regexp_like   (' ','^*[ ]*a')
    NOTE: cannot fetch plan for SQL_ID: 04mpgrzhsv72w, CHILD_NUMBER: 0
          Please verify value of SQL_ID and CHILD_NUMBER;
          It could also be that the plan is no longer in cursor cache (check v$sql_p
    lan)No plan...
    Let's take a look at the 10053 trace file:
    Registered qb: SEL$1 0x19157f38 (PARSER)
      signature (): qb_name=SEL$1 nbfros=1 flg=0
        fro(0): flg=4 objn=258 hint_alias="DUAL"@"SEL$1"
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    CVM: Considering view merge in query block SEL$1 (#0)
    CBQT: Validity checks failed for 7uqx4guu04x3g.
    Subquery Unnest
    SU: Considering subquery unnesting in query block SEL$1 (#0)
    Set-Join Conversion (SJC)
    SJC: Considering set-join conversion in SEL$1 (#0).
    Predicate Move-Around (PM)
    PM: Considering predicate move-around in SEL$1 (#0).
    PM:   Checking validity of predicate move-around in SEL$1 (#0).
    PM:     PM bypassed: Outer query contains no views.
    FPD: Considering simple filter push in SEL$1 (#0)
    FPD:   Current where clause predicates in SEL$1 (#0) :
              REGEXP_LIKE (' ','^*[ ]*a')
    kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
    predicates with check contraints:  REGEXP_LIKE (' ','^*[ ]*a')
    after transitive predicate generation:  REGEXP_LIKE (' ','^*[ ]*a')
    finally:  REGEXP_LIKE (' ','^*[ ]*a')
    apadrv-start: call(in-use=592, alloc=16344), compile(in-use=37448, alloc=42256)
    kkoqbc-start
                : call(in-use=592, alloc=16344), compile(in-use=38336, alloc=42256)
    kkoqbc-subheap (create addr=000000001915C238)Looks like the query never had a chance to start executing - it is still parsing after 20 minutes.
    I am not sure that this is a good example - the query either executes very fast, or never has a chance to start executing. But, it might still make your point physical I/O is not always the problem when performance problems are experienced.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Improve the query performance

    Hi, I need help for improving query performance..
    I have a query in which i am joining 2 tables, join after some aggregation. Both table has more than 50 million record. 
    There is no index created on these table,both tables are loaded after truncation. So is it required to create index on this table before joining? The query status was showing 'suspended' since it was running for long time. For temporary purpose, i just executed
    the query multiple times by changing month filter each times. 
    How can i improve this instead of adding month filter and running multiple times

    Hi Nikkred,
    According to your description, you are joining 2 table which contain more than 50 million records. Now what you want is improving query performance, right?
    Query tuning is not an easy task. Basically it depends on three factors: your degree of knowledge, the query itself and the amount of optimization required. So in your scenario, you can post your detail query, so that you can get more help. Besides, you
    can create index on your table which can improve the performance. Here are some links about performance tuning tips for you reference.
    http://www.mssqltips.com/sql-server-tip-category/9/performance-tuning/
    http://www.infoworld.com/d/data-management/7-performance-tips-faster-sql-queries-262
    Regards,
    Charlie Liao
    TechNet Community Support

Maybe you are looking for

  • Voice memos lost after restore. I've tried everything.

    When I plugged my iPhone 5 in a few weeks ago it said it needed to update the software. I clicked OK. It froze hard while doing this. I had to do a restore. That's when I "lost" my voice memos. For voice memos I use the app "Recorder" by Bear-Softwar

  • Is there any way to reset security questions without a vocal contact with Apple?

    Yesterday I've tried to buy a song from iTunes, and it's surprised me that I've been ask to answer some security questions I have made long time ago and unfortunately I can't recall the answers of these security questions, I've tried to reset the sec

  • Dual ddr?

    i have a MSI K7N2-L, with 2x256MB PC2700 kingston ram. i found no option in bios to enable the DUAL DDR thing. and i am not sure if i am using the DUAL DDR or not. plz help!

  • Ago function - Aggrgate Table.

    Hi , tnks in advance for your replies. I have one aggregate table(created in by db oracle 10g/r2) where i have the sum of "qty" and "sale_price" in a level of month. I have a calendar dimension --->year->half->quarter->month(where month is my lower l

  • What is causing my macbook pro to hard freeze?

    My 2011 15" MacBook Pro started hard freezing recently a couple months ago. The screen goes black and the computer seems to be stuck on a loop. If music is playing, it will repeat the same second of music over and over until I hold the power button.