Query Cost GL_JE_LINES

Dear All,
Im working on R12.1.1 and Database Version is 11.1.0.7. . . There are more than *33326139* in GL_JE_LINES Table and its cost is *228155*. I want to reduce its cost because the queries and reports which are using this table is performed very slow.
Regards

How to post a tuning request
When your query takes too long ...
HOW TO: Post a SQL statement tuning request - template posting
HTH
Srini

Similar Messages

  • Query cost is changing when used in a VO

    Hi All
    I have created the view with the below query
    SELECT component_item_name segment1,component_item_id inventory_item_id,organization_id,assembly_item_id
    FROM BOMFG_BOM_COMPONENTS WHERE organization_id = :1
    AND NVL(END_EFFECTIVE_DATE,SYSDATE ) >= SYSDATE
    AND EXISTS
    ( SELECT 1
    FROM apps.fnd_common_lookups fcl, mtl_system_items_b msi
    WHERE fcl.lookup_type = 'ITEM_TYPE' AND msi.item_type = fcl.lookup_code
    AND msi.inventory_item_id = component_item_id AND msi.organization_id = :2
    AND msi.item_type IN ('ATO','OPTIONAL FEAT')
    ) START WITH assembly_item_id = :3 CONNECT BY PRIOR component_item_id =assembly_item_id GROUP BY component_item_name,component_item_id,organization_id,assembly_item_id
    The cost of the above query is just 13 .
    attached this VO with one LOV in my page.
    when query gets executed while openign the page , the OA Framework is taking above query as
    select * from (SELECT component_item_name segment1,component_item_id inventory_item_id,organization_id,assembly_item_id
    FROM BOMFG_BOM_COMPONENTS WHERE organization_id = :1
    AND NVL(END_EFFECTIVE_DATE,SYSDATE ) >= SYSDATE
    AND EXISTS
    ( SELECT 1
    FROM apps.fnd_common_lookups fcl, mtl_system_items_b msi
    WHERE fcl.lookup_type = 'ITEM_TYPE' AND msi.item_type = fcl.lookup_code
    AND msi.inventory_item_id = component_item_id AND msi.organization_id = :2
    AND msi.item_type IN ('ATO','OPTIONAL FEAT')
    ) START WITH assembly_item_id = :3 CONNECT BY PRIOR component_item_id =assembly_item_id GROUP BY )component_item_name,component_item_id,organization_id,assembly_item_id
    and the query cost becomes 21000 .
    Because of this, VO takes longer than expected time .
    pls suggest how can I handle this ,
    Thanks
    Naveen
    Edited by: user640347 on Mar 10, 2010 12:27 AM

    Hi,
    Just tell me one thing you execute the query at backend after providing the inputs.
    now again after the page has loaded and then again execute the lov query at backend with same input
    variables.
    Now if the query is same then how can the cost differ?
    Verify it.
    Thanks,
    Gaurav

  • How query cost and execution time are releated ?

    hi experts,
      i am curious to know, how the query cost and execution time is related?
     Query taking less time ,query cost is 65%, but query taking more time but query cost is 0%.
    how to connect both and improve query performance.
    Thanks

    i think you are refering to cost (relative to the batch) execution 65%, where there are more that one statement, it may compare the cost of each statement with in the batch
    i assume it mainly take subtree cost and IO stat as cost, but in some cases i may wrong when there is multi line function and many other facter influence the cost, and i would say it depends on the query
    cost is unit-less
    The reason these costs exist is because of the query optimization SQL Server does: it does cost-based optimization, which means that the optimizer formulates a lot of different ways to execute the query, assigns a cost to each of these alternatives, and
    chooses the one with the least cost. The cost tagged on each alternative is heurestically calculated, and is supposed to roughly reflect the amount of processing and I/O this alternative is going to take.
    refer :
    http://blogs.msdn.com/b/sqlqueryprocessing/archive/2006/10/11/what-is-this-cost.aspx
    Thanks
    Saravana kumar C

  • Query Cost vs SQL statistics

    I have a query and when I execute it it gives a cost of 4000+, however after I optimized it came down to about 300 or so.
    My problem is that after discussing the query with my manager he showed me that the statistics of the first query version where better than the second one (we made sure it was not cached ).
    How come that the second one runs faster and has less cost even if the SQL statistics is worse?
    example:
    first query:
    cost: 4000
    time to run: 2:00+ minutes
    1 recursive call
    1310 consistent gets
    2600 physical reads
    second query:
    cost: 290
    time to run: ~1:30 minutes
    1200 recursive calls
    13000 consistent gets
    30000 physical read

    user8973401 wrote:
    I have a query and when I execute it it gives a cost of 4000+, however after I optimized it came down to about 300 or so.
    How come that the second one runs faster and has less cost even if the SQL statistics is worse?
    example:
    first query:
    cost: 4000
    time to run: 2:00+ minutes
    1 recursive call
    1310 consistent gets
    2600 physical reads
    second query:
    cost: 290
    time to run: ~1:30 minutes
    1200 recursive calls
    13000 consistent gets
    30000 physical readI personally use execution time along with the metrics you listed together to determine when one version of a query is better than another. There are gray areas like the situation you listed where "better" is hard to determine. Another useful metric is CPU, which AUTOTRACE does not list but can be found using V$SQL, traces, or AWR reports. Sometimes the biggest challenge is making sure the result set of the tuned query is the same as the original one ;)
    You listed mixed results which can happen. The run time was 2 minutes vs 1:30 but other metrics were higher. The CPU on the first query might be lower.
    Oh, it DOES happen that a higher-cost version of a query executes faster and uses fewer resources than a lower-cost version. Remember that the COST is an estimate which is usally but not alway accurate

  • Query cost and CASE statement

    Hi, I'm working on a performance issue for a customer.
    I'm tuning some suspect SQL that uses complex DECODE statements to perform IF/THEN/ELSE logic.
    I've taken a statement and rewritten it using CASE however what I've noticed is the cost of the query execution plan has increased dramatically as a result. N.B. I haven't changed the WHERE clause of the query as yet, just replaced one DECODE with the equivalent CASE.
    The db version is 9.2.0.4. Does anyone know of issues with the performance of CASE as opposed to DECODE. I'm wondering should I leave the DECODEs as is even though they're way too complicated.
    Tks,
    Paul.

    Here's an example of a DECODE:
    nvl(count(distinct decode
    (decode(sign(ords.dwh_created_date_id-:v_start_cycle_id),1,1,0,1,-1,0) *
    decode(sign(:v_end_cycle_id-ords.dwh_created_date_id),1,1,0,1,-1,0),1,ords.dwh_order_id,NULL)),0) calc1
    The equivalent CASE I've coded is:
    NVL(COUNT(DISTINCT(CASE WHEN (ords.dwh_created_date_id BETWEEN :v_start_cycle_id AND :v_end_cycle_id)
    THEN
    ords.dwh_order_id
    ELSE
    NULL
    END)),0) calc1
    I've been doing further testing with an amended WHERE clause and did run both CASE and DECODE versions. The performance difference between the two was negligible. So it seems (as I'd hoped) that the amendment of the execution path doesn't appear to be affected by CASE even though Oracle reports the query cost of it is higher.
    It is slightly confusing though. Is the query cost in this case a red herring ?

  • SQL Query Cost Report..

    Hi all,
    I am novice to OEM. I wanted to do / run sql query cost report.. How can i do it in OEM.?? Is it possible to do in OEM..??? Please guide me to solve this problem.??
    Your suggestion will be helpful.
    Thanks,
    -Mahesh.

    Hi,
    Thanks for your reply, but I want info about Oracle Enterprise Manager 10g.
    Actual requirement is like this,
    We have script files written in Linux Shell scripts, which are related to DB activities like Startup DB, Shutdown DB, perfstat, checking free space etc etc. These we want to migrate into OEM using OEM built-in features, few of which we've already migrated. We have analyzed scripts. One of the script is for SQL Query Cost Report (Which i didn't get what it does..)
    So is there any option/inbuilt feature through which we can do "SQL Cost Report".
    Once again thanks for your reply.
    -Mahesh.

  • Webi report on OLAP Bex query -  Cost element Hierarchy not working Drill down

    Hello,
    We have a BO report on Bex query, Not on universe, we have a Hierarchy for Cost Element Group, and we are expecting the Drill down functionality for that in BO report, but it does not.
    Webi report on OLAP Bex query -  Cost element Hierarchy not working Drill down
    Any pointers how to do it please
    Thanks
    Krishna

    Hi,
    WebI reports on BEx source don't use same Drill feature as other sources, it's replaced by expland/collapse of hierarchy nodes (documented in WebI user guide in § "24.1 Drill defined"). This means you have to create query which selects all hierarchy sub-tree you plan on exploring later in report, otherwise if no data is available under a node there will be no '+/-' sign to visit this part of tree.
    You could try first to select "All members" from hierarchy in QueryPanel and see if behavior in report suits your needs. Then you should restrict hierarchy member selection to what's really needed to avoid performance issues.
    Regards,
    Loic

  • To get Query cost

    Hi all,
    Am having postgres as database.In order to find the query cost i use explain and then give the query.At this juncture i have couple of doubts :
    1) What is the difference between hash join and merge join
    2) What is to be considered, to arrive at a conculsion that a query cost is more or less.
    Kindly provide your inputs.
    Regards
    Sriram

    Thanks for the url.
    I know that, but still just in case if someone in the forum would have used it then it would be a great help to me.
    Regards
    Sriram

  • Ad Hoc Query - cost assignment

    Hi Experts,
    I'm  trying to pull the contents of 'Cost Assignment' field i.e manually entered cost centre  which is available as a button on infotype 2002 & 2003 screens.
    In an Ad-hoc Query, it is not available as a field in any of the standard infosets.
    Is there a simple way of adding in the IT2003 cost assignment field?
    Please help.
    Thanks,
    Arpita

    Hi,
    You need to add table ASSOB_HR to your infoset. The cost assignment data is stored in that table. Use PERNR and INFTY to get the cost assignment data.
    Hope this helps.
    Donnie

  • Dynamically extracting SQL query costs/statistics at runtime

    Hi there,
    I need to measure the I/O cost (such as 'physical reads')of a SQL statement at runtime. What I'm looking to do is to test the total cost of a number of queries in a java program. So I need to get the cost automatically and add them up.
    There are a few tools that can give statistics on I/O cost, such as autotrace, but I need to collect these information using Java through JDBC.
    Any pointers?
    Also I am a little confused about the terms used in oralce. What I need is the number of db blocks accessed by the query, either from buffer or disk. Are these referred as 'logical read' and 'physical read' respectively? Or are 'logical read' and 'physical read' just mean the number of reads?
    Thank you,

    Logical and consistent reads are against the DB Buffers, Physical reads are disk io. When evaluating the cost of a query, pay attention to an abnormally high number of logical reads. This is usually an indicator of a poorly performing query ie a correlated sub-query.

  • Performance - reading the query cost

    Which of these three represent the most efficient query?  I'm wondering if the smallest plan in bytes is the best plan.  Also, are eager spools expensive or inexpensive, and is a smaller sub-tree cost better than a larger sub-tree cost?  The
    first plan is 48 bytes and the second is 160 bytes.   Both return the same records.  project is smaller than architecture but architecture comes from a different database.
    R, J

    The architecture table is small with about 1700 records, the project table is small with about 1100 records, the access_level, approval_version, and security_classifications are tiny.  This is a group of tables called repeatedly for security. 
    It's more like a scalar function (though it seeds a table) or perhaps it can be considered as a boolean qualifier.   The upper one is a modification that removes the tables that are joined in from another databases.  Those have been removed
    and placed into a single schema-bound table.  The query executes in about 10 milliseconds but is frequently blocked by itself.
    My question is more about the way the scan plan changes (hashes, eager spools and so on).  The cost of the architecture scan doesn't change much but it pushes the table into the calling database to the top of the query plan and most of the scan becomes
    a hash.  There's a third rendition where the LEFT JOIN is changed to a LEFT LOOP JOIN [which I recently discovered].   I expected the schema-binding to provide better results - so the first of the two would be the better plan, I suppose. 
    I'm not sure.  With the loop join condition, I was able to force a seek.   It also crossed my mind that given the tiny size of the tables, perhaps they'd be better off without an index.
    Here is what happens when the LOOP JOIN condition is added.
    R, J

  • Less sql query cost ... but more time to fetch the records...

    Hi,
    I faced up to a 'peculiar' situation with a costly db view.
    I attempted to reduce the total view cost
    specifically for 223 records fetched{the cost from 149 reduced to 74,
                                                           the recursive calls from 796 reduced to 224,
                                                           the consistent gets from 311516 reduced to 310341,
                                                            the physical reads from 7 reduced to 0}
    but the amount of time needed to fetch the results is greater than the old version of the db view....{it may be the double...}
    Have you any idea about this...????
    Note: I have got fresh statistics...
             I use db 10g v.2
    Thanks,
    Sim

    Try tracing the query and see what tkprofs shows you.
    alter session set events '10046 trace name context forever, level 12';
    run the query
    alter session set events '10046 trace name context off';
    Then run tkprofs on the trace file produced to see where the database is spending its time/effort. Do likewise for the baseline query in a different session (so you will generate a different trace file).
    If that does not produce anything useful, try using
    alter session set events '10053 trace name context forever';
    run the query
    alter session set events '10053 trace name context off';
    Then examine the trace file to see if you can learn anything.
    Since you have not given us anything more to go on, that is about all the help I can give....

  • Query Cost Center and Cost Element Hierarchy

    here is the problem.
    We are trying to build a query that does the following.
    Its a CCA query.
    We have Costcenter in the Filter area with a Hierarchy assigned and a hierarchy node variable attached.
    We run the report and its looks good and the user cannot drill down because nothing is in the "rows" area. Its perfect.
    Now the user has said that within that Costcenter Hierarchy we only want to see a total number based on the CostElement Hierarachy assigned. Different CostElement Hierarchys are valid for different times of the budget.
    I have created a Hierarchy variable and attached it to the CostElement.
    Here is The issue ****
    If I drop the Costelement in the "rows"area it prompts for the Hierarchy name , filters Costcenter properly and provides the extact number. Problem is the user can now drill down and that is not allowed becuase we are going to have 3 summary totals with a "grand total" at the bottom.
    So if I put the CostElement in the Filter area it now does not filter the CostCenter and I get the wrong number.
    Is there a way to prevent drill down or some how force the CostCenter to be filtered by CostElement also.
    Thanks for any help
    Richard

    Hi Richard,
    Not sure if this will help as I have not tried it out, but you can try by setting the display property of Cost Element to No Display, when it is in the Rows area. This can be done by Cost Element > Right Click > Display As > No Display.
    Hope this helps...

  • Any difference between distinct and aggregate function in sql query cost???

    Hi,
    I have executed many sql stmts patterns- such as:
    a) using a single table
    b) using two tables, using simple joins or outer joins
    but i have not noticed any difference in sql stmts in cost and in execution plan....
    Anyway, my colleague insists on that using aggregate function is less costly compared to
    distinct....(something i have not confirmed, that's why i beleive that they are exactly the same...)
    For the above reffered 1st sql pattern.. we could for example use
    select distinct deptno
    from emp
    select count(*), deptno
    from emp
    group by deptno select distinct owner, object_type from all_objects
    select count(*), owner, object_type from all_objects
    group by owner, object_typeHave you found any difference between the two ever...????
    Note: I use Ora DB 10g v2.
    Thank you,
    Sim

    distinct and aggregate function are for different uses and may give same result but if u r using aggregate function to get distinct records, it will be expensive...
    ex
    select distinct deptno from scott.dept;
    Statistics
    0 recursive calls
    0 db block gets
    2 consistent gets
    0 physical reads
    0 redo size
    584 bytes sent via SQL*Net to client
    488 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    4 rows processed
    select deptno from scott.emp group by deptno;
    Statistics
    307 recursive calls
    0 db block gets
    60 consistent gets
    6 physical reads
    0 redo size
    576 bytes sent via SQL*Net to client
    488 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    6 sorts (memory)
    0 sorts (disk)
    3 rows processed
    Nimish Garg
    Software Developer
    *(Oracle & ASP.NET)*
    Indiamart Intermesh Limited, Noida
    To Get Free Oracle & ASP.NET Code Snippets
    Follow: http://nimishgarg.blogspot.com

  • How to know if executing a query cost long time

    Hi,
    I have a question about how to figure out if execution of a query takes long time. I am building a web application in java. The back end database is oracle. If a query is too large, I want to put show the user the error message to let the user make more specific query. but how can I tell if the query execution takes long time? Thanks.

    The following link may be of help.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3175.htm#1123208

Maybe you are looking for

  • Missing content exporting from InDesign CC 2014 to Flash Pro CC 2014

    Dear all, to produce a larger number of similar animated swf's, I wanted to create all necessary text and graphic layers in InDesign CC 2014, then export as *.fla to Flash Pro CC 2014 for "bulk" animation. Finally it should then just be a case of sel

  • Namespace issue while generating XML based on xsd

    Hi All, I am using Jdeveloper-11.1.1.6 SOA:- 11.1.1.6 WLS:- 11.3.6 When i am publishing xml message i am getting name space issue. My process design as i am getting a message from AQ JMS and doing a transformation with out any logic and writing into

  • Connection sharing for embedded JDBC and DatabaseController

    <p> </p><p>I would like to share an existing JDBC connection with the DatabaseController (i.e. same session in database).  Basically I need to call a stored proc in the JSP page then use the same (already established and open) connection for the Data

  • Personal Domain Names in iWeb/MobileMe?

    Why is it that MobileMe will now not accept UK domain names? I have a .co.uk domain name and can no longer use it with the new MMe. When I first started to use iWeb and .Mac I purchased a UK domain name and had it entered in the personal domain name

  • Change my country

    Hi, I want to change my country from Australia to Indiain apple account. And i want to update my Indian Credit card details to the Apple account.Wen i was in Australia, i bought some appplications from apple store, at that timeof purchase apple store