Subquery Factoring -Performance Issue

Hi experts,
Oracle 10G
select
a.colums,
b.columns
from
( select
Colums
from
F ,
(select
columns
from
bigtable
where
<condition with recdate and modified date with timezone convertions Given as in end of this qury)
) a,
( select
Colums
from
tables,
(select
columns
from
bigtable
where
<condition with recdate and modified date with timezone convertions Given as in end of this qury)
) b
(TO_DATE(TO_CHAR(FROM_TZ(CAST(CF.RECDT as timestamp),'GMT') at time zone 'America/Chicago','YYYY-MM-DD
HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')
     BETWEEN TO_DATE('01-JAN-2009 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('08-JAN-2009 00:00:00', 'DD-MON-YYYY
HH24:MI:SS')) OR
(TO_DATE(TO_CHAR(FROM_TZ(CAST(CF.MODIFID_DT as timestamp),'GMT') at time zone 'America/Chicago','YYYY-MM-DD
HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')
BETWEEN TO_DATE('01-JAN-2009 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('08-JAN-2009 00:00:00', 'DD-MON-YYYY
HH24:MI:SS'))
Recdt - indexed
Modifieddt - not iddexed
bigtable used many times in select to avoid Subquery factoring used (with select) but it increased cost as per explain plan in sqldevleoper please suggest me to increase performance
Lots of thanks,
Kalinga

now the above query use as
with subfact as
( select
select
columns
from
bigtable
where
<condition with recdate and modified date
select
a.colums,
b.columns
from
( select
Colums
from
F ,
subfact
where condition
) a,
( select
Colums
from
tables,
subfact
where condition
) b
it is cost increased in nested loop in explain plan why? is thre any other detail required.

Similar Messages

  • UNION Subquery Factoring performance

    Hi,
    We have 2 'with' clauses, each ones works fine, and the performance is good.
    If I try to join the 2 'with' queries together, either using union all (which is what we really want), or an inner join.
    Its a 9.2.0.5 database, and all the statistics are up to date!
    Thanks for any help.
    Hannah

    The query is:
    with
    allele_number_one AS
      (SELECT hbo1.hla_test_id,
         hbo1.hla_test_name,
         hbo1.hla_broad_order,
         '1' test_specific_order,
         stm1.sample_id,
         hbo1.hla_left,
         hbo1.hla_right,
         hbo1.hla_class,
         hbo1.hla_locus,
         stm1.test_class,
         stm1.homozygous,
         'allele one'
       FROM sample_test_map stm1,
         hla_broad_order hbo1
    --   WHERE stm1.sample_id = 293602
       where hbo1.hla_test_id = stm1.hla_test_id
       AND stm1.test_class = 1
       AND hbo1.hla_class = 4
       AND NOT EXISTS
        (SELECT 'f'
         FROM sample_test_map stm2,
           hla_broad_order hbo2
         WHERE stm2.sample_id = stm1.sample_id
         AND hbo2.hla_test_id = stm2.hla_test_id
         AND hbo2.hla_class = hbo1.hla_class
         AND hbo2.hla_test_id <> hbo1.hla_test_id
        AND hbo2.hla_locus = hbo1.hla_locus
          AND hbo2.hla_broad_order < hbo1.hla_broad_order
         AND stm2.test_class = 1)
      -- if they are children of homozygous parents, only report one
      AND NOT EXISTS
        (SELECT 'f'
         FROM sample_test_map stm3,
           hla_broad_order hbo3
         WHERE stm3.sample_id = stm1.sample_id
         AND hbo3.hla_test_id = stm3.hla_test_id
        AND hbo3.hla_class = hbo1.hla_class
         AND hbo3.hla_test_id < hbo1.hla_test_id
         AND hbo3.hla_locus = hbo1.hla_locus
         AND stm3.test_class = stm1.test_class
         AND hbo3.hla_broad_order = hbo1.hla_broad_order)),
    allele_number_two AS
      (SELECT hbo1.hla_test_id,
         hbo1.hla_test_name,
         hbo1.hla_broad_order,
         '2' test_specific_order,
         stm1.sample_id,
         hbo1.hla_left,
         hbo1.hla_right,
         hbo1.hla_class,
         hbo1.hla_locus,
         stm1.test_class,
         stm1.homozygous,
         'allele two'
       FROM sample_test_map stm1,
         hla_broad_order hbo1
    --   WHERE stm1.sample_id = 293602
       WHERE hbo1.hla_test_id = stm1.hla_test_id
       AND stm1.test_class = 1
       AND hbo1.hla_class = 4
    -- and hasn't been determined as a 'left' one
       AND NOT EXISTS
        (SELECT 'f'
         FROM allele_number_one an1
         WHERE an1.hla_test_id = stm1.hla_test_id
         AND an1.sample_id = stm1.sample_id
         AND an1.hla_broad_order = hbo1.hla_broad_order
         AND an1.test_class = stm1.test_class
         AND an1.homozygous = stm1.homozygous)
    select * from allele_number_one
    where sample_id = 293602
    union all
    select * from allele_number_two
    where sample_id = 293602And the explain:
    SELECT STATEMENT     CHOOSE     12     4     467                         
         TEMP TABLE TRANSFORMATION                                             
              UNION-ALL                                             
                   VIEW          2     1     164                         
                        TABLE ACCESS(FULL) SYS.SYS_TEMP_0FD9D6778_3099A94B     ANALYZED     2     1     36                         
                   HASH JOIN(ANTI)          10     3     303                         
                        HASH JOIN          7     3     108                         
                             INDEX(RANGE SCAN) NTXD_TEST.SAMPLE_TEST_MAP_PK     ANALYZED     3     3     33                         TABLE ACCESS(FULL) NTXD_TEST.HLA_BROAD_ORDER     ANALYZED     3     832     20800                    
                   VIEW          2     1     65                         
                        TABLE ACCESS(FULL) SYS.SYS_TEMP_0FD9D6778_3099A94B     ANALYZED     2     1     36

  • WITH Subquery Factoring OR "Scalar SubqueriesRun Another Query per row

    Hi Experts
    Please suggest
    which one query is better
    Involved table p is of size 2GB and c1/c2 of size 800M.
    And we have to run a report on p which will do FTS (no where clause on p)
    So FTS on 2 GB table and then running Another Query per row .. so results job very slow
    1)  Select p.id,
             (select sum(q1) from c1 where c1.id = p.id) c1_sum1,
             (select sum(q2) from c2 where c2.id = p.id) c2_sum2
       from p
    2)
    WITH Subquery Factoring
    with c1_vw as
    (select id, sum(q1) c1_sum1
        from c1
             group by id),
       c2_vw as
       (select id, sum(q2) c2_sum2
           from c2
          group by id),
       c1_c2 as
       (select c1.id, c1.c1_sum1, c2.c2_sum2
           from c1_vw c1, c2_vw c2
          where c1.id = c2.id )
       select p.id, c1_sum1, c2_sum2
          from p, c1_c2
         where p.id = c1_c2.id
       / 10.2..0.4
    AIX 5.3
    Thanks In Advance
    ivw

    ivw wrote:
    which one query is betterThe better query IMHO is the one that returns the the correct results in the shortest amount of time using the least system resources (the last two items usually happen at the same time). Maintainability is an issue too. Which one do you like best?
    Its hard to say which query will run best without running both, getting execution plans, and run-time statistics. At a pure guess I would think all things being equal they would have similar performance but do not really know.

  • Performance Issues with 10.6.7 and External USB Drives

    I've had a few performance issues come up with the latest 10.6.7 that seem to be related to external USB drives. I have a 2TB USB drive tha I have my iMovie content on this drive and after 10.6.7 update, iMovie is almost unusable. Finder even seems slow when browsing files on this drive as well. It seems like any access to the drive is delayed in all applications. Before the update, the performance was acceptable, but now it almost unusable. Most of the files on this drive are large dv files.
    Anyone else experience this?

    Matt,
    If you want help, please start your own thread here:
    http://discussions.apple.com/forum.jspa?forumID=1339&start=0
    And if your previous thread you aren't getting sufficient help for your iPhone, post a new topic here:
    http://discussions.apple.com/forum.jspa?forumID=1139
    You'll get a wider audience, and won't confuse the original poster. Performance issues can be caused by numerous issues as outlined in my FAQ*
    http://www.macmaps.com/Macosxspeed.html
    If every person who had a performance issue posted to this thread, we'd never find a solution for the initial poster. Let's isolate each case one by one. It is NOT necessarily the same issue, even if the symptoms are the same. There are numerous contributing factors at work with computers, and if we don't isolate them, we'll never get to the root cause.

  • Performance issue with Adobe forms

    Dear SAP Experts,
    We have the following issue/requirement from our client. The client is on SAP ECC 6.0 - production environment.
    The client is highlighting  performance issue while accessing the adobe forms for HR and FI business process ( both static and interactive ).
                    Examples are
        FI – Invoice Approvals
                    HR – Job Salary Change
    The client is asking us to provide best practices surrounding:
    1.       How to improve the performance of the adobe forms while accessing in SAP.
    2.       Is there any other technology which we can use in SAP to replace the adobe forms which has better performance factor.
    3.       Are there solutions such as webdynpro floor plan manager, UI Fiori which can be alternately used?
    Regards,
    Sakthi

    Hello Priya,
         Adobe forms are easy to develop and much more comfortable than SAP Scripts and Smartforms. Initially they are a bit difficult but once you have your hands on, they are the most simplest things in ABAP.
    Performance in Adobe forms is a mix of both fine tuning the Layout as well as back end coding.
    Performance in Adobe forms cannot be done overnight. A lot of care has to be taken during the initial stage of development.
    As far as my experience is concerned, please consider the below points while developing SAP Adobe forms.
    1) Avoid Scripting (Javascript/Formcalc) as much as possible inside the form. It drastically reduces the performance and makes the form to execute slower. If you still want to use scripting(which cannot be avoided for some requirements), use Formcalc since it is comparatively faster than JavaScript.
    2) Try to avoid the coding inside the Form Interface. You can always handle the maximum coding in the Driver program and pass it to the form.
    3) Use Form Caching.
    For forms that have fixed layout, its a good way to increase the performance of form rendering. In the layout, go to Form Properties. Then Click on Defaults tab and select Allow Form Rendering To Be Cached On Server. Then Click OK.
    For forms that have flowable or dynamic layout, render the forms on the client side because it improves performance.
    Last but not the least, please go through the below post by Otto Gold which is worth a read at least once.
    How to write a messy form

  • OBIEE 11g "WITH SAWITH0 AS" subquery factoring clause in the generated sql

    I've observed that the OBIEE 11g generates in the query log physical query using the WITH (sub-query factoring) clause to make the generated sql elegantly readable. This is great! Thanks for the developers. However I have some questions about this.
    __Background__
    Oracle Database' default behaviour is that if you have only one sub-query in the WITH section, it executes it as an in-line view and does not materialize it before the main sql is executed. If you have more than one, by default the database engine materializes all of them in the order of the definition. In some cases this can completely blow up the SGA and make the query never ending. To divert this behaviour you can apply two hints that work both in inline views and in sub-queries as well: /*+ MATERIALIZE */ and /*+ INLINE*/, however Analytics 11g does not seem to have hint capabilities at the logical table level, only at physical table level.
    If we go with the current defaults, developers not aware of this feature can bump into serious performance issues for the sake of some syntax candy at the generated sql level, I'm afraid.
    __Questions__
    * Is it possible to turn the Analytics server not to use WITH but use inline views instead?
    * Is there any way to sneak in some hints that would put the /*+ INLINE */ hint to the appropriate place in the generated sub-queries if needed
    * Does the Oracle Database have any initialization parameter that can influence this sub-query factoring behavior and divert from the default?

    The WITH statement is not added to make the query more elegant, it's added for performance reasons. If your queries take long to run then you may have a design issue. In a typical DWH DB SGA needs to be seriously increased since the queries ran are much larger and complex than on an OLTP DB. In any case you can disable the WITH statement in the Admin Tool by double clicking on your database object on the physical layer and going to the Features tab. The feature is called WITH_CLAUSE_SUPPORTED.

  • Performance issues -- related to printing

    Hi All,
    I am haviing production system performance issues related to printing. endusers are telling the printing is slow for almost printers. We are having more that 40 to 50 printers in landscape.
    As per my primary investigation I didnt find any issues in TSP01 & TSP02 tables. But I can see the table TST01 and TST03 table having many number of entries (more that lakh). I dont have idead about this table. Is ther eany thing related to this table where the print causes slowness or any other factors also makes this printing issue .. Please advice ..
    thanks in advance

    Hai,
    Check the below link...
    http://help.sap.com/saphelp_nw70/helpdata/en/c1/1cca3bdcd73743e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/04ca3bb6f8c21de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/86/1ccb3b560f194ce10000000a114084/content.htm
    TemSe cannot administer objects that require more than two gigabytes of storage space, regardless of whether the objects are stored in the database or in the file system. Spool requests of a size greater than two gigabytes must therefore be split into several smaller requests.
    It is enough if you perform the regular background jobs and Temse consistency checks for the tables.
    This will help in controlling the capacity problems.
    If you change the profile parameter rspo/store_location parameter value to 'G' this will make the performance better. The disadvantages are TemSe data must be backed up and restored separately from the database using operating system tools, In the event of problems, it can be difficult to restore consistency between the data held in files and the TemSeu2019s object management in the database. Also you have take care of the Hard disk requirements because in some cases, spool data may occupy several hundred megabytes of disk storage. If you use the G option, you must ensure that enough free disk space is available for spool data.
    Regards,
    Yoganand.V

  • Performance Issues after an Upgrade

    Hello!
    We are experiencing performance issues after we upgraded to a new version of Hyperion (11.1.2.1). At this point, I am not too sure about the actual causes for this degrade in performance but I am trying to narrow down the causes and need your inputs. Please help me with your ideas.
    1) What could be the causes/factors for the performance to degrade after an upgrade?
    2) Does the performance of a script depend on the user credentials i.e. who is launching the script? Whether it’s the super admin of the application/application owner or an application specific admin?
    3) Does the performance of the scripts depend on the place you are launching it from? For example - will the performance differ if it’s launched from MaxL Vs EAS?
    Please let me know your thoughts on this.
    Thanks,
    - Krrish

    There are a number of bugs 12600557, 12675485, 12669814, 12698488 logged in for 11.1.2.1 - If you use Internet Explorer 8 and have data forms designed to use a large number of sparse dimension members in rows or columns, you may experience performance degradation when opening the data forms.
    This has been fixed in Oracle Hyperion Planning, Fusion Edition Release 11.1.2.1 Patch Set Update (PSU): 11.1.2.1.101 which is available on My Oracle Support as Patch 12666861.
    HTH-
    Jasmine.

  • Convert smartform to PDF Convert_OTF - Performance Issue

    Hi gurus,
    We have a custom development for Compensation statement developed smartform that could have easily been done in Adobe PDF. The downside of this is ithat whenever we want to download to PDF, the program first coverts this smart form to PDF usinf funciton module "Convert_OTF" and then downloads it.
    Did any one face this performance issue. Is the convert to OTF a major time consuming process
    We are having system performance issue when downloading the comp statement and want to analysize how big this CONVERT_OTF is a factor.
    please suggest

    Ok
    Iìve never had particular performance problem with that function, so:
    have you tried to measure the time for the printing (smartform), for the convertion (convert_otf) and for the downloading separatly?
    Max

  • Bug in WITH clause (subquery factoring clause) in Oracle 11?

    I'm using WITH to perform a set comparison in order to qualify a given query as correct or incorrect regarding an existing solution. However, the query does not give the expected result - an empty set - when comparing the solution to itself in Oracle 11 whereas it does in Oracle 10. A minimal example os posted below as script. There are also some observations about changes to the tables or the query that make Oracle 11 returning correct results but in my opinion these changes must not change the semantics of the queries.
    Is this a bug or am I getting something wrong? The Oracle versions are mentioned in the script.
    -- Bug in WITH clause (subquery factoring clause)
    -- in Oracle Database 11g Enterprise Edition 11.2.0.1.0?
    DROP TABLE B PURGE;
    DROP TABLE K PURGE;
    DROP TABLE S PURGE;
    CREATE TABLE S (
         m     number NOT NULL,
         x     varchar2(30) NOT NULL
    CREATE TABLE K (
         k char(2) NOT NULL,
         x varchar2(50) NOT NULL
    CREATE TABLE B (
         m     number NOT NULL ,
         k char(2) NOT NULL ,
         n     number
    INSERT INTO S VALUES(1, 'h');
    INSERT INTO S VALUES(2, 'l');
    INSERT INTO S VALUES(3, 'm');
    INSERT INTO K VALUES('k1', 'd');
    INSERT INTO K VALUES('k2', 'i');
    INSERT INTO K VALUES('k3', 'm');
    INSERT INTO K VALUES('k4', 't');
    INSERT INTO K VALUES('k5', 't');
    INSERT INTO K VALUES('k6', 's');
    INSERT INTO B VALUES(1, 'k1', 40);
    INSERT INTO B VALUES(1, 'k2', 30);
    INSERT INTO B VALUES(1, 'k4', 50);
    INSERT INTO B VALUES(3, 'k1', 10);
    INSERT INTO B VALUES(3, 'k2', 20);
    INSERT INTO B VALUES(3, 'k1', 30);
    INSERT INTO B VALUES(3, 'k6', 90);
    COMMIT;
    ALTER TABLE S ADD CONSTRAINT S_pk PRIMARY KEY (m);
    ALTER TABLE K ADD CONSTRAINT K_pk PRIMARY KEY (k);
    ALTER TABLE B ADD CONSTRAINT B_S_fk
    FOREIGN KEY (m) REFERENCES S(m) ON DELETE CASCADE;
    CREATE OR REPLACE VIEW v AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC;
    -- Query 1: Result should be 0
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT COUNT(*)
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- COUNT(*)
    -- 6
    -- 1 rows selected
    -- Query 2: Result set should be empty (Query 1 without counting)
    WITH q AS
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    SELECT *
    FROM
    SELECT * FROM q
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM q
    -- M N
    -- null 10
    -- null 30
    -- null 40
    -- 1 40
    -- 3 10
    -- 3 30
    -- 6 rows selected
    -- Observations:
    -- Incorrect results in Oracle Database 11g Enterprise Edition 11.2.0.1.0:
    -- Query 1 returns 6, Query 2 returns six rows.
    -- Correct in Oracle Database 10g Enterprise Edition 10.2.0.1.0.
    -- Correct without the foreign key.
    -- Correct if attribute x is renamed in S or K.
    -- Correct if attribute x is left out in S.
    -- Correct without the ORDER BY clause in the definition of q.
    -- Only two results if the primary key on K is left out.
    -- Correct without any change if not using WITH but subqueries (see below).
    -- Fixed queries
    -- Query 1b: Result should be 0
    SELECT COUNT(*)
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- COUNT(*)
    -- 0
    -- 1 rows selected
    -- Query 2b: Result set shoud be empty (Query 1b without counting)
    SELECT *
    FROM
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    MINUS
    SELECT * FROM v
    UNION ALL
    SELECT * FROM v
    MINUS
    SELECT * FROM
    SELECT S.m, B.n
    FROM S JOIN B ON S.m=B.m JOIN K ON B.k=K.k
    WHERE K.x='d'
    ORDER BY B.n DESC
    -- M N
    -- 0 rows selected

    You're all gonna love this one.....
    The WITH clause works. But not easily.
    Go ahead, build the query, (as noted in a recent thread, I, too, always use views), set the grants and make sure DISCOVERER and EULOWNER have SELECT privs.
    1. Log into Disco Admin as EULOWNER. Trust me.
    2. Add the view as a folder to the business area.
    3. Log into Disco Desktop as EULOWNER. Don't laugh. It gets better.
    4. Build the workbook and the worksheet (or just the worksheet if apropos)
    5. Set the appropriate "sharing" roles and such
    6. Save the workbook to the database.
    7. Save the workbook to your computer.
    8. Log out of Desktop.
    9. Log back into Desktop as whatever, whoever you usually are to work.
    10. elect "open existing workbook"
    11. Select icon for "open from my computer". See? I told you it would get better!
    12. Open the save .dis file from your computer.
    13. Save it to the database.
    14. Open a web browser and from there, you're on your own.
    Fortran in VMS. Much easier and faster. I'm convinced the proliferation of the web is a detriment to the world at large...On the other hand, I'm also waiting for the Dodgers to return to Brooklyn.

  • Subquery Factoring and Materialized Hint

    WITH t AS
            (SELECT MAX (lDATE) tidate
               FROM rate_Master
              WHERE     Code = 'G'
                    AND orno > 0
                    AND TYPE = 'L'
                    AND lDATE <= ':entereddate')
    SELECT DECODE (:p1,  'B', RateB,  'S', RateS,  Rate)
      FROM rate_Master, t
    WHERE     Code = 'G'
           AND orno > 0
           AND TYPE = 'L'
           AND NVL (lDATE, SYSDATE) = tidate;In the given example the sub query returns just one row because of the aggregate function max. Making this in to a With clause will be of any benefit ? Also i presume/understand that the subquery factoring would be really useful only when we try to make a sub query which returns more rows in a with clause. Is my intrepration right?
    Secondly adding the /*+ Materialize */ hint to a With query is mandatory or the optimizer by itself will do it and make a temp table transformation. In my example i am forced to give the hint in the query. Please discuss and help
    Thanks in advance.

    ramarun wrote:
    WITH t AS
    (SELECT MAX (lDATE) tidate
    FROM rate_Master
    WHERE     Code = 'G'
    AND orno > 0
    AND TYPE = 'L'
    AND lDATE <= ':entereddate')
    SELECT DECODE (:p1,  'B', RateB,  'S', RateS,  Rate)
    FROM rate_Master, t
    WHERE     Code = 'G'
    AND orno > 0
    AND TYPE = 'L'
    AND NVL (lDATE, SYSDATE) = tidate;In the given example the sub query returns just one row because of the aggregate function max. Making this in to a With clause will be of any benefit ? Also i presume/understand that the subquery factoring would be really useful only when we try to make a sub query which returns more rows in a with clause. Is my intrepration right?I am not aware of any performance Benefit due to use of With clause. IMO, It eases the job to write a Subquery multiple times in a query.
    The solution you adopted has to hit the cache twice and hence do not look very performant. I will advise you to opt for Analytic functions (like the suggestion I provided in another thread). If the solution does not yeild correct results, then provide with a Script that we can replicate (Create table, Sample Insert statement and the expected output).
    select decode(:p1, 'B', RateB, 'S', RateS, Rate)
       from (
                select RateB, RateS, Rate, NVL(ldate, sysdate) ldate, dense_rank() over (order by case when NVL(lDATE, SYSDATE) <= ':entereddate' then NVL(lDATE, SYSDATE) else to_date('01/01/1970', 'DD/MM/YYYY' end DESC) rn
                  from rate_Master
               where Code = 'G'
                   and orno > 0
                   and type = 'L'
             ) a
      where a.rn = 1;>
    Secondly adding the /*+ Materialize */ hint to a With query is mandatory or the optimizer by itself will do it and make a temp table transformation. In my example i am forced to give the hint in the query. Please discuss and help
    Usage of Hints is only for Debugging purposes and is not meant to be used in production code. It is when you have to ascertain the reason for CBO choosing a plan that you do not expect it to take, you use hints to force your plan and find the cost and analyze it. Hence, I do not support the idea of Hints for production code.

  • How to use subquery factoring ("with" clause) in OWB?

    Hi,
    Is it possible to use subquery factoring (popularly known as "with" clause) in OWB 10gR2? I have a mapping with a splitter and union-all, which generates a query that has repeated scans of the same table. Subquery Factoring would be very useful here. I think this is a very common situation, so, I hope there's a way to achieve this. (If not in this version, this would be my wishlist item for the next version.)
    Appreciate your help.
    Regards,
    Rahul

    Hi Rahul,
    I'm afraid you have to put this on your wishlist. You may put the query with the "with"-clause into a view (or table function if you need parameters) if performance is too bad. But that is somehow against the idea (and benefits) of owb.
    Another possibility is to use a temporary table and spilt the mappings into two parts: first fill the temp table, then the target table.
    Regards,
    Carsten.

  • Oracle 9i Performance Issue High Physical Reads

    Dear All,
    I have Oracle 9i Release 9.2.0.5.0 database under HP Unix, I have run the query and got following output. Can any body just have a look and advise what to do in the following situation? We have performance issues.
    Many thanks in advance
    Buffer Pool Advisory for DB: DBPR Instance: DBPR End Snap: 902
    -> Only rows with estimated physical reads >0 are displayed
    Size for Size Buffers for Est Physical Estimated
    P Estimate (M) Factr Estimate Read Factor Physical Reads
    D 416 .1 51,610 4.27 1,185,670,652
    D 832 .2 103,220 2.97 825,437,374
    D 1,248 .3 154,830 2.03 563,139,985
    D 1,664 .4 206,440 1.49 412,550,232
    D 2,080 .5 258,050 1.32 366,745,510
    D 2,496 .6 309,660 1.23 340,820,773
    D 2,912 .7 361,270 1.14 317,544,771
    D 3,328 .8 412,880 1.09 301,680,173
    D 3,744 .9 464,490 1.04 288,191,418
    D 4,096 1.0 508,160 1.00 276,929,627

    Hi,
    Actually you didnt give the exact problem statement.
    Seems to be your database is I/O bound. Ok, do the following one by one:
    1. Identify the FTS queries and try to create the optimal indexes (depending on the disk reads factor!!) on the problem queries.
    2. To reduce the 276M physical reads, you need to allocate more memory to db_cache_size. try 8GB (initially) and then depending on the buffer advisery you can increase further if you have more memory on the box.
    3. as a Next step , configure KEEP and RECYCLE cache to get the benefits of reduced I/O by multiple pools. Allocate objects to the KEEP/RECYCLE pools.
    Thanks,

  • Query Performance Issue (help)

    I'm having issues w/ huge performance issues on the following. The sub intersect query lists duplicates in table1 and table2...and deletes those results from table2. But, the dups criteria is not looking at all fields, only those in the subquery....
    DELETE  FROM isw.accounts2     
           WHERE id_user||''||SYSTEM_ID||''||NM_DATABASE IN (
                  SELECT id_user||''||SYSTEM_ID||''||NM_DATABASE
                     FROM (
                           SELECT id_user, domain_name, system_name, user_description,
                                  user_dn, fl_system_user, dt_user_created,
                                  dt_user_modified, pw_changed, user_disabled,
                                  user_locked, pw_neverexpired, pw_expired,
                                  pw_locked, cd_geid, user_type, nm_database,
                                  cd_altname, fl_lob, cd_account_sid, system_id
                           FROM isw.accounts       -- accounts
                           WHERE SYSTEM_ID IN (SELECT SYSTEM_ID FROM SYSTEMS
                                               WHERE FL_LOB =  'type'  AND
                                               FL_SYSTEM_TYPE = 'Syst')
                           INTERSECT
                           SELECT id_user, domain_name, system_name, user_description,
                                  user_dn, fl_system_user, dt_user_created,
                                  dt_user_modified, pw_changed, user_disabled,
                                  user_locked, pw_neverexpired, pw_expired,
                                  pw_locked, cd_geid, user_type, nm_database,
                                  cd_altname, fl_lob, cd_account_sid, system_id
                           FROM isw.accounts2       --accounts_temp
                           WHERE SYSTEM_ID IN (SELECT SYSTEM_ID FROM SYSTEMS
                                               WHERE FL_LOB = 'type'
                                               AND FL_SYSTEM_TYPE =  'syst')
               )Edited by: Topher34 on Oct 24, 2008 12:00 PM
    Edited by: Topher34 on Oct 24, 2008 12:01 PM

    PLAN_TABLE_OUTPUT
    Plan hash value: 2030965500
    | Id  | Operation              | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |               |     1 |   623 |  2269   (7)| 00:00:28 |
    |*  1 |  FILTER                |               |       |       |            |          |
    |*  2 |   HASH JOIN SEMI       |               |     1 |   623 |   236   (2)| 00:00:03 |
    |   3 |    TABLE ACCESS FULL   | ACCOUNTS_BAX2 |     1 |   603 |   222   (1)| 00:00:03 |
    |*  4 |    TABLE ACCESS FULL   | SYSTEMS       |    15 |   300 |    14   (8)| 00:00:01 |
    |   5 |   VIEW                 |               |     1 |   117 |  2032   (7)| 00:00:25 |
    |   6 |    INTERSECTION        |               |       |       |            |          |
    |   7 |     SORT UNIQUE        |               |  2145 |   418K|            |          |
    |*  8 |      HASH JOIN         |               |  2145 |   418K|  1793   (8)| 00:00:22 |
    |*  9 |       TABLE ACCESS FULL| SYSTEMS       |    15 |   300 |    14   (8)| 00:00:01 |
    |* 10 |       TABLE ACCESS FULL| ACCOUNTS_BAX  |  2269 |   398K|  1779   (8)| 00:00:22 |
    |  11 |     SORT UNIQUE        |               |     1 |   588 |            |          |
    |* 12 |      HASH JOIN         |               |     1 |   588 |   236   (2)| 00:00:03 |
    |* 13 |       TABLE ACCESS FULL| ACCOUNTS_BAX2 |     1 |   568 |   222   (1)| 00:00:03 |
    |* 14 |       TABLE ACCESS FULL| SYSTEMS       |    15 |   300 |    14   (8)| 00:00:01 |
    Edited by: Topher34 on Oct 27, 2008 8:08 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Subquery factoring and DB Link

    Hello,
    2 node RAC
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - ProductionI have a query of the form..
    WITH temp as
                 (select col1, col2, col3 from LOCAL_TABLE)
               SELECT /*+ driving_site (remote1) */
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 null,
                 null
              from remote_view1@dblink remote1, -- Remote View over 2 dbs
                     remote_view2@dblink remote2  -- Remote View over 2 dbs
               where remote1.col1 in (select col1 from temp);This query used to work, but recently there has been a change in remote_view1 after which the query takes a long time to execute.
    The good performing query takes 2 secs, while the bad performing one takes about 8 minutes.
    However, if I remove the subquery factoring and include the query as a sub-query it works well.
               SELECT /*+ driving_site (remote1) */
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote1.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 remote2.col1,
                 null,
                 null
              from remote_view1@dblink remote1, -- Remote View over 2 dbs
                     remote_view2@dblink remote2  -- Remote View over 2 dbs
               where remote1.col1 in  (select col1, col2, col3 from LOCAL_TABLE);I tried to check the data from v$sql. I observed that;
    v$sql.remote = 'Y' - good performance
    v$sql.remote = 'N' - bad performance
    Has anyone faced this situation ?
    Rgds,
    Gokul

    Am I right in assuming that queries executed entirely on remote db don't have plans stored in v$sql_planRight.
    SQL> select /*+ domtest */ 1 from dual@domtest;
             1
             1
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  9d51rf84zvt0s, child number 0
    select /*+ domtest */ 1 from dual@domtest
    NOTE: cannot fetch plan for SQL_ID: 9d51rf84zvt0s, 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_plan)
    8 rows selected.
    SQL> select sql_id, remote, sql_text from v$sql where sql_id = '9d51rf84zvt0s';
    SQL_ID        R SQL_TEXT
    9d51rf84zvt0s Y select /*+ domtest */ 1 from dual@domtest
    SQL> select * from v$sql_plan where sql_id = '9d51rf84zvt0s';
    no rows selected
    SQL> select /*+ domtest */ 1 from dual@domtest t, dual;
             1
             1
    Elapsed: 00:00:00.00
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  d0m08znks4yak, child number 0
    select /*+ domtest */ 1 from dual@domtest t, dual
    Plan hash value: 3754369022
    | Id  | Operation            | Name | Rows  | Cost (%CPU)| Time     | Inst   |IN-OUT|
    |   0 | SELECT STATEMENT     |      |       |     4 (100)|          |        |      |
    |   1 |  MERGE JOIN CARTESIAN|      |     1 |     4   (0)| 00:00:01 |        |      |
    |   2 |   REMOTE             | DUAL |     1 |     2   (0)| 00:00:01 | DOMTE~ | R->S |
    |   3 |   BUFFER SORT        |      |     1 |     2   (0)| 00:00:01 |        |      |
    |   4 |    FAST DUAL         |      |     1 |     2   (0)| 00:00:01 |        |      |
    Remote SQL Information (identified by operation id):
       2 - SELECT 0 FROM "DUAL" "T" (accessing 'DOMTEST' )
    22 rows selected.
    Elapsed: 00:00:00.04
    SQL> select sql_id, remote, sql_text from v$sql where sql_id = 'd0m08znks4yak';
    SQL_ID        R SQL_TEXT
    d0m08znks4yak N select /*+ domtest */ 1 from dual@domtest t, dua
    SQL> select /*+ driving_site(t) */ 1 from dual@domtest t, dual;
             1
             1
    Elapsed: 00:00:00.00
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    SQL_ID  741u736nrk6dx, child number 0
    select /*+ driving_site(t) */ 1 from dual@domtest t, dual
    NOTE: cannot fetch plan for SQL_ID: 741u736nrk6dx, 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_plan)
    8 rows selected.
    Elapsed: 00:00:00.01
    SQL> select sql_id, remote, sql_text from v$sql where sql_id = '741u736nrk6dx';
    SQL_ID        R SQL_TEXT
    741u736nrk6dx Y select /*+ driving_site(t) */ 1 from dual@domtest
                    t, dual
    Elapsed: 00:00:00.00
    SQL>
    SQL> select * from v$sql_plan where sql_id = '741u736nrk6dx';
    no rows selected
    Elapsed: 00:00:00.01
    SQL> Edited by: Dom Brooks on Aug 21, 2012 1:05 PM

Maybe you are looking for

  • Prevent creation of PO  and not PR

    Hi, Requirement is to prevent PO creation for a material type for a particular status and not Purchase requisition. By making Purchasing message u201CBu201D for a particular material status, it gives error message while creation of PO and purchase re

  • Read last characters of file

    Hello everybody, I have got a question here, how to read the last bytes of a file. In my case, I have a file, and at the end of that file there is a MD5 hash. This hash is allways 128 Bit long (32 UTF8 Chars) so it is easy for me to find it. I know h

  • Invalid Owner error preventing project creation in PWA but not ProjectPro

    Greetings, I get the following error when trying to create a new project in PWA using one of our template plans: Datasets: ProjectDataSet Table Assignment Row:  ASSN_UID='c5cd689e-3b4a-e411-9843-00155d244b00' PROJ_UID='bf346e98-3b4a-e411-9843-00155d2

  • After Effects 2014 CC Ram Preview Issue

    Ever since I upgraded to CC 2014(from CC) I have been experiencing an issue. My RAM preview will start somewhere in the middle of my in/out points. I have to wait for it to loop to see the beginning. I have tried checking/unchecking "from current tim

  • CNG not detected in fax call

    Hi, When using on-ramp t.37 gateway to detect fax calls, using the script called "app_fax_detect.2.1.2.2.tcl" the CNG is not detected. DTMF activation (pressing 2) works, but CNG is not detected. Any ideas ? Avner.