ORACLE: RULE vs CHOOSE

Can someone help me with the following query:
Query 1 runs slowly
delete from tempsevnd_temp t 
where t.order_number in (select order_number           from sevnd s
          where s.order_number = t.order_number
            and s.call_status = 'C')

PLAN_TABLE_OUTPUT

 
---------------------------------------------------------------------------------
| Id  | Operation                     |  Name           | Rows  | Bytes | Cost  |
---------------------------------------------------------------------------------
|   0 | DELETE STATEMENT              |                 |   328 |  5576 |   986 |
|   1 |  DELETE                       | TEMPSEVND_TEMP  |       |       |       |
|   2 |   NESTED LOOPS SEMI           |                 |   328 |  5576 |   986 |
|   3 |    TABLE ACCESS FULL          | TEMPSEVND_TEMP  |   328 |  2296 |     2 |
|   4 |    TABLE ACCESS BY INDEX ROWID| SEVND           |    69M|   663M|     3 |
|   5 |     INDEX RANGE SCAN          | I_SEVND         |    13 |       |     2 |
---------------------------------------------------------------------------------
 
Note: cpu costing is off, PLAN_TABLE' is old version
Now, I use the indicator / * + rule * /, and the above query runs pretty fast:
delete /*+ rule*/  from tempsevnd_temp t 
where t.order_number in (select order_number           from sevnd s
          where s.order_number = t.order_number
            and s.call_status = 'C')
            ;

PLAN_TABLE_OUTPUT

 
---------------------------------------------------------------------------------
| Id  | Operation                     |  Name           | Rows  | Bytes | Cost  |
---------------------------------------------------------------------------------
|   0 | DELETE STATEMENT              |                 |       |       |       |
|   1 |  DELETE                       | TEMPSEVND_TEMP  |       |       |       |
|   2 |   FILTER                      |                 |       |       |       |
|   3 |    TABLE ACCESS FULL          | TEMPSEVND_TEMP  |       |       |       |
|   4 |    TABLE ACCESS BY INDEX ROWID| SEVND           |       |       |       |
|   5 |     INDEX RANGE SCAN          | I_SEVND         |       |       |       |
---------------------------------------------------------------------------------
 
Note: rule based optimization, PLAN_TABLE' is old version
The results are the same with IN and EXISTS.
Please suggest what is the difference between the two?

user1170666 wrote:
I analyzed the original table, and the temporary table is a refreshment, a daily fall.
This used to run fast, do not know what went wrong...

Can u explain wht happens when I give tip RULE?

If you see execution plan for CBO his go to the SEMI of NESTED LOOP and SET his will for the FILTER.

I suggest that scan you the temporary table also.

Tags: Database

Similar Questions

  • Create a rule to choose the percentage-based WMS

    WMS Guru.

    I would create a WMS collection rule that limits / directs allowances in the subinventory in BULK is the quantity is 95 to 105% of the amount of cases.

    Is this possible?

    If the transaction UOM is EA

    and the amount of transaction is > = 95% case amount

    and the amount of transaction is < = quantity of cases article 105%

    and subinventory is in BULK

    You may think using the following:

    Subinventory/Locator.Actual point the available quantity / txn UOM on the left-hand side of the rule and make the comparison with the actual quantity of Transaction.Transaction (or mptdtv.transaction_quantity).

    something like...

    Subinventory/Locator.Actual point the available quantity / txn UOM<= expression="" 105%="" of="">

  • Oracle EPM 11.1.1: Issue of business rules

    Hi all

    I installed Oracle EPM 11.1.1 and I created a planning application. However, when I connect to the analytical Administration console and try to create a business rule I am faced with the following question:

    1. when I try to select planning application I get the following errors:

    Error connecting to server < servername > Essbase / < Application name >.

    Detail: could not connect to Planning Server

    2. as it implemented autour, I the Essbase outline and the rule is validated AAS. This rule has been attached to a form and must be performed when I do a mailing. However, the rule does not form. I tried to run the rule of web Planning and even once, I get an error.

    I checked the access rights for the shared services business rule and the admin user (which I use) has available and administrator rights. Is this a configuration problem or is there something I'm missing here.

    Thanks in advance,

    Amol

    Hello

    I usually begin in the following order
    RMI
    EAS
    Planning

    Then connect to the planning application, then go to INJURED and if the provision is set, then you should be able to create a business rule and choose the application you accessed.
    If there are problems, then there may be a configuration problem.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Business rule to use member of form page

    Hi all

    I need to create a business rule that uses a member of the page of the form. A variable RTP created and used in the Rule.Attached the rule and choose 'use the shape members' and 'hide at short notice. But, always request invite. How to display the prompt?

    Is the type RTP or members, keep Member.

  • RUL-05717: identifier "Header.Teachers.Courses" is not valid here

    I am trying to add rules in my dictionary oracle through programming in adf jdeveloper:

    Rule rule = ruleset.getRuleTable().add();

    rule.setName(aliasRule);

    rule.setAlias(aliasRule);

    rule.setPriority(property); 

    rule.setAdvancedMode(true);

    rule.setDescription(description);

      return rule;

    then:

    diccionaryRules.validate(exceptions, warnings);

    I have three warnings with the same message:

    RUL-05717: The identifier "Header.Teachers.Courses"is not valid here.

    Where in my oracle.rules file I have three viewobjects talk about links via private key ids :

    1. Header
    2. Teachers
    3. Course

    And the road is correct: Header.Teachers.Courses .

    I created the following path expression:

    Header.Teachersby:

    Expression ePath = simpleTest.getExpressionTable().get(0);

    ePath.setValue("Header.Teachers"); 


    // Here comes some validation

    List<SDKWarning> warnings = new ArrayList<SDKWarning>();

    List<SDKException> exceptions = new ArrayList<SDKException>();

    ePath.validate(exceptions, warnings);

    It gives no warnings, but this:

    ePath.setValue("Header.Teachers.Courses");   

    gives the warning above.

    I don't know why I get these warnings.

    The facts of the ADF - BC view objects which are connected by links have incorrect types, which is why oracle that api rules can not form good objects of these types to the following process.

    Change these incorrect types for the types of objects of view necessary solved my problem.

  • Example of a rule for the capacity of the file system

    Hello

    on 5.6.4 I'm looking for an example of creating a rule to trigger an email when there are less than 10 GB on a disc on a Win Server?

    Thank you.

    You can change any rule and add an e-mail action

    If you experiment with rule changes that I recommend to copy the existing rule and change the copy.

    What about adding the e-mail action, you can consult the Administrator's guide on Association rules with actions

    http://eDOCS.quest.com/Foglight/565/doc/core/AdministrationConfiguration/FineTuning_Ref.104.20.php#493111

    Regarding thresholds, just copy the name of the variable to the rule and look under registry variables

    http://eDOCS.quest.com/Foglight/565/doc/core/AdministrationConfiguration/FineTuning.103.5.php

    Rules can be deleted, go on the dashboard of rules and choose the 'old manage rules', you can select a rule and delete selected (I tested it on the rule of bsm and it seems to work).

    I highly recommend that rather than remove one out of the box you rule disable.

    Hope this helps

    Golan

  • Data selection in UDB where columns were named after the oracle data types

    I have a couple of tables in UDB, I'm trying to reference on a HS db link.

    The first table on the side of the UDB has a column named 'number' (bought the software - not something we did)...

    Selecting this SEO column in this table and more specifically (i.e. Select number, col2, col3 etc) causes the error ORA-00936 (missing expression).

    Select * works...

    The second table also has a column called 'number', so the same problem above applies.  [However, sql errors when I do a select * from ORA-00600: internal error code, arguments: [HO set: look long], [], [], [], [], [], [], [], [], [], []]

    Our dba lean on it, - Oracle HS is new to us, so - I was hoping someone here might have an idea...

    Using oracle 11.2.0.3.0.

    When your DB2 database has column with reserved words in Oracle names, you must create a view of your DB2 side by specifying a different name for this column, and then use DG4ODBC to choose from the scoreboard instead of DB2.

    Another approach which would require an additional programming is to use the DBMS_HS_PASSTHROUGH that allows to make statements that they are to the DB2 database without be analyzed in Oracle.

    As for the ORA-600 error that you get this error is caused when your DB2 table contains certain character inspired columns that exceed the accuracy of the Oracle and are then mapped to the Oracle long data types. Normally in Oracle each table can have a long column. But to be able to select with the gateways of databases foreign this restriction has been slightly improved and more recent Oracle software can choose from the tables that contain more then a long.

    So, could you please be more specific what program you use to select using the gateway fails with ORA-600 and could you please post your description of the table as it is stored in your DB2 database as seen using the gateway in SQL * more: desc (your DB2 table > @)

    -Klaus

  • Update Server, Oracle DB JVM side

    Our $ORACLE_HOME/jdk/bin/java is the version 1.5.0
    We have to 1.6.24... where is the documentation for this upgrade
    If not, what are these upgrade steps:

    Thank you!

    >
    Our $ORACLE_HOME/jdk/bin/java is the version 1.5.0
    We have to 1.6.24... where is the documentation for this upgrade
    If not, what are these upgrade steps:
    >

    The JVM is part of the Oracle, and without the correct version, certified the JVM the database does not work correctly. Indeed, if you are using Oracle install and choose to remove the JVM the database itself disappears also.

    Oracle 11g install with JDK 1.5 and it's the ONLY version that is certified to work correctly with 11g. If you try to use any other version you violate your support contract and will likely errors.

    The installed version of the JDK is that Oracle itself uses and version is the version that will be used for all the Java classes that you load into the database and run in Oracle.

    You are free to use any version of the JDK you want for external applications to Java.

    Why do say that you 'need to upgrade' to 1.6.24?

  • uninstall the virtual machine JAVA of oracle 11g

    How to uninstall machine virtual JAVA to oracle 11g...

    >
    our client won't allow to JDK 1.5 to run on their cloud; our choice is so to uninstall the component in the FMV of the Oracle, or upgrade the JDK for 1.6_24
    >
    Then unfortunately, your choice is to uninstall the Oracle database or choose another cloud provider.

    Oracle is expected to announce that 12 Oracle Openworld, but Larry Ellison has already said that
    http://www.CIO.com.au/article/437037/oracle_announce_cloud_infrastructure_service_openworld_ellison_says/
    >
    Database 12 c will not come until the "December, January, February next year", said Ellison.
    >
    And who knows which version of Java will be included.

  • Notification and alert rules

    I created 5 rules of the 'Rules of Notification' section by using the same user ID.

    Is it possible to groups of different e-mail alert for each notification since the same ID. rule We choose the "send e-mail" option in the section rules of Notification, we will receive alerts for e-mail identification that has been configured in the general Section under-> Preferences. How to configure the rules to notify different group using the same ID.

    Thanks in advance.

    Just to clarify - Loc response is for 12 c. Also - the email is sent to an e-mail address that is mentioned in the rule, if the owner of the rule has the privileges to see the event/incident, etc..

    11g, I think that the mechanism is to create accounts to different users for different addresses.

  • Need help to write to Oracle and SQL Server in the Oracle triggering

    We have a third which feeds data for us. Their client application feeds directly to some source tables in our Oracle database 10g. We have triggers on those tables that sort and treat lines as they come.

    We have a new operation and try to write some of these incoming data now to a SQL Server database through heterogeneous services - essentially the same exact data in two databases. I have a related database that works very well for the selection, but I've never tried to write Oracle PL/SQL to write in a DB SQL Server 2008. My first attempt was met with the following error: "ORA-02047: impossible to join the current distributed transaction.

    I found another thread where they say that the only way to do it is by using a stand-alone transaction, but they do not give an example. Here is the section of relaxation that I use:
      select to_char(new_date,'MM-DD-YYYY') into sql_txt from dual;
      insert into mancamp_location@sqlweb
           ("UnitID", "ManCampID", "Lat", "Long", "UpdateDT", "VehSpeed", "VehDirection", "Landmark")
        values (v_truck, f_unit, f_lat, f_long, sql_txt, f_spd, f_dir, f_ldmk);
    Can someone point me to a way to accomplish this simple insertion?

    An example of a standalone trigger is:

    Suppose you have a table in Oracle:

    CREATE TABLE emp_sal
    (
    EMPNO NUMBER 4,
    SAL NUMBER (7.2));

    and a similar table in a SQL server:
    SQL Server:

    CREATE TABLE emp_sal
    (
    EMPNO NUMERIC (4).
    SAL NUMERIC (7.2));

    Then, you can create an insert trigger that replicates the data:
    CREATE OR REPLACE TRIGGER dg4odbc_repl AFTER INSERT ON emp_sal
    FOR EACH LINE
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    INSERT INTO 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB '.
    VALUES (: new.empno,: new.sal);
    COMMIT;
    END;
    /

    -Note the validation, otherwise risk of ORA-6519

    When you now insert a record into the Oracle database:
    insert into emp_sal values (1234, '1200,89');
    the trigger is activated and inserts the record in SQL Server:
    Select * from 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB;
    EMPNO, SAL
    ----- -------
    1234 1200.89

    It works fine when you post data insert, but as soon as restore you the insert only data Oracle will be cancelled - data will remain as long as the independent transaction dedicated to its SQL Server insert:

    insert into emp_sal values (1384, '1200,89');
    Rollback;
    Select * from emp_sal;
    EMPNO, SAL
    ----- -------
    1234 1200.89

    Select * from 'emp_sal"@MSODBCSQLSERVER_DG4ODBC_EMGTW_1123_DB;
    EMPNO, SAL
    ----- -------
    1234 1200.89
    1384 1200.89

    So I strongly recommend to use the DG4MSQL gateway which is able to participate in distributed transactions and allows validation/restore transactions.

    DG4ODBC lie on OTN (http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html-online check out the "See all" link for your favorite platform), cloud of delivery of software Oracle (https://edelivery.oracle.com/) or "My Oracle Support". My Oracle support welcomes the latest version 11.2.0.3. In My Oracle Support goto patches and updates, then search for 11.2.0.3 data set Patch 10404530patch: 11.2.0.3.0 PATCH SET for ORACLE database SERVER, choose your preferred platform and see the Readme which CD contains the gateway software.

    Published by: kgronau on April 24, 2012 08:44

  • Interview with slow and fast 32 bit Oracle series control in oracle 64-bit.

    Hello
    I need help.
    I have a machine with Windows with Oracle 10.2.0.4 32 bits (DB - A)
    And a machine with 64 bit HPUNIX with Oracle 10.2.0.4 (DB - B)

    A query that I run on DB series - has in 140 mili sec

    And the same query on DB - B takes 10 Sec.

    The delay on DB - B is the only sort Index which is used to sort the data in ascending order. (DB - A uses this same index if present)

    Now I just googled around, I got some suspicion as "being 64-bit has more sorting area optimizer Oracle 32-bit choose from uses the index" is this true?

    Waiting for your response.

    Thank you and best regards,
    Vinay Mistry
    OFSSTORES.net s/n
    Atos Origin India

    Explain plans: -.
    DEVELOPMENT
    Plan
    INSTRUCTION SELECT ALL_ROWS cost: 137 bytes: 6 384 cardinality: 8
    ORDER of SORTING 63 BY cost: 137 bytes: 6 384 cardinality: 8
    62 of HASH JOIN cost EXTERNAL: 136 bytes: 6 384 cardinality: 8
    Cost EXTERNAL 60 NESTED LOOPS: 133 bytes: 6 304 cardinality: 8
    57 LOOPS IMBRIQUEES cost: 132 bytes: 6 152 cardinality: 8
    54 HASH JOIN cost EXTERNAL: 116 bytes: 5 584 cardinality: 8
    52 HASH JOIN EXTERNAL cost: 112 bytes: 5 440 cardinality: 8
    50 LOOPS IMBRIQUEES EXTERNAL cost: 109 bytes: 5 296 cardinality: 8
    HASH JOIN cost EXTERNAL 47: 101 bytes: 5 160 cardinality: 8
    Cost EXTERNAL 45 NESTED LOOPS: 95 bytes: 4 912 cardinality: 8
    Cost EXTERNAL 42 NESTED LOOPS: 87 bytes: 4 416 cardinality: 8
    Cost EXTERNAL NESTED LOOPS 39: 79 bytes: 4 344 cardinality: 8
    Cost EXTERNAL 36 NESTED LOOPS: 71 bytes: 4 208 cardinality: 8
    Cost EXTERNAL 33 NESTED LOOPS: 63 bytes: 3 736 cardinality: 8
    Cost EXTERNAL LOOPS IMBRIQUEES 30: 58 bytes: 3 360 cardinality: 8
    Cost EXTERNAL 27 NESTED LOOPS: 54 bytes: 3 136 cardinality: 8
    Cost EXTERNAL 24 NESTED LOOPS: 52 bytes: 2 912 cardinality: 8
    Cost EXTERNAL NESTED LOOPS 21: 44 bytes: 2 568 cardinality: 8
    LOOPS IMBRIQUEES EXTERNAL cost 18: 43 bytes: 2 416 cardinality: 8
    15 LOOPS IMBRIQUEES of EXTERNAL cost: 27 bytes: 2 152 cardinality: 8
    Cost EXTERNAL 12 NESTED LOOPS: 11 bytes: 1 928 cardinality: 8
    Cost 10 NESTED LOOPS: 7 bytes: 1 664 cardinality: 8
    Cost EXTERNAL 7 NESTED LOOPS: cardinality 3 bytes: 70: 1
    Cost EXTERNAL NESTED LOOPS 4: 02:00 cardinality: 1
    OFS_ST_DB_CH. cost R_TXN TABLE TABLE ACCESS BY INDEX ROWID 2: 02:00 cardinality: 1
    1 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_TXN cost: cardinality 1: 1
    3 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_STO cost: 0 bytes: 25 552 cardinality: 3 194
    TABLE 6 ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_AU cost: 1 bytes: 316 176: 11 292 cardinality
    5 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_AU cost: cardinality 0: 1
    9 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_TXN_PRO_STO cost: 4 bytes: 1 104 cardinality: 8
    8 INDEX RANGE SCAN INDEX OFS_ST_DB_CH. TXN__TXN_PRO_STO_FK cost: cardinality 2: 8
    11 INDEX RANGE SCAN (SINGLE) OFS_ST_DB_CH INDEX. Cost PK_PRO_VEN_DET: 02:00 cardinality: 1
    OFS_ST_DB_CH. cost R_STO_PRO TABLE TABLE ACCESS BY INDEX ROWID 14: 02:00 cardinality: 1
    13 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_STO_PRO cost: cardinality 1: 1
    OFS_ST_DB_CH. cost R_STO_PRO TABLE TABLE ACCESS BY INDEX ROWID 17: 02:00 cardinality: 1
    16 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_STO_PRO cost: cardinality 1: 1
    TABLE 20 ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_SRP cost: 1 bytes: cardinality 1: 19
    19 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_SRP cost: cardinality 0: 1
    23 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_VEN_PRO_CAT cost: 1 bytes: cardinality 1: 43
    22 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_VEN_PRO_CAT cost: cardinality 0: 1
    26 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_AU cost: 1 bytes: cardinality 1: 28
    25 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_AU cost: cardinality 0: 1
    29 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_AU cost: 1 bytes: cardinality 1: 28
    28 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_AU cost: cardinality 0: 1
    32 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_PAC cost: 1 bytes: cardinality 1: 47
    31 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_PAC cost: cardinality 0: 1
    35 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_STO cost: 1 bytes: cardinality 1: 59
    34. THE INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_STO cost: cardinality 0: 1
    38 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_GEO_STR cost: 1 bytes: cardinality 1: 17
    37. THE INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_GEO_STR cost: cardinality 0: 1
    41 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_VEN_DET cost: 1 bytes: cardinality 1: 9
    40 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_VEN_DET cost: cardinality 0: 1
    44 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_STO cost: 1 bytes: cardinality 62: 1
    43. THE INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_STO cost: cardinality 0: 1
    TABLE 46 ACCESS COMPLETE OF THE TABLE OFS_ST_DB_CH. R_CO cost: 5 bytes: 22 103 cardinality: 713
    49 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_GEO_STR cost: 1 bytes: cardinality 1: 17
    48 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_GEO_STR cost: cardinality 0: 1
    TABLE 51 ACCESS COMPLETE OF THE TABLE OFS_ST_DB_CH. R_STO_TYP cost: 3 bytes: 270 cardinality: 15
    TABLE 53 ACCESS COMPLETE OF THE TABLE OFS_ST_DB_CH. R_STO_TYP cost: 3 bytes: 270 cardinality: 15
    56 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_PRO cost: 2 bytes: 71 cardinality: 1
    55 INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_PRO cost: cardinality 1: 1
    59 TABLE ACCESS BY INDEX ROWID TABLE. OFS_ST_DB_CH R_SRP cost: 1 bytes: cardinality 1: 19
    58. THE INDEX UNIQUE INDEX (SINGLE) OFS_ST_DB_CH SCAN. PK_SRP cost: cardinality 0: 1
    61 FULL TABLE ACCESS TABLE. OFS_ST_DB_CH cost R_PAR_TYP: 03:00 cardinality: 4



    QA
    Plan
    INSTRUCTION SELECT FIRST_ROWS cost: 342 389 bytes: 326 230 cardinality: 190
    Cost EXTERNAL 67 NESTED LOOPS: 342 389 bytes: 326 230 cardinality: 190
    Cost EXTERNAL 64 LOOPS IMBRIQUEES: 342 202 bytes: 324 330 cardinality: 190
    Cost of 61 LOOPS IMBRIQUEES: 342 178 bytes: 320 720 cardinality: 190
    Cost EXTERNAL 58 NESTED LOOPS: 341 796 bytes: 307 230 cardinality: 190
    Cost EXTERNAL 55 NESTED LOOPS: 341 794 bytes: 303 620 cardinality: 190
    Cost EXTERNAL 52 NESTED LOOPS: 341 750 bytes: 282 340 cardinality: 190
    Cost EXTERNAL 49 NESTED LOOPS: 341 705 bytes: 263 720 cardinality: 190
    Cost EXTERNAL 46 NESTED LOOPS: 341 514 bytes: 262 010 cardinality: 190
    Cost EXTERNAL 43 NESTED LOOPS: 341 322 bytes: 255 930 cardinality: 190
    Cost EXTERNAL 40 NESTED LOOPS: 341 087 bytes: 249 660 cardinality: 190
    Cost EXTERNAL 37 NESTED LOOPS: 341 026 bytes: 240 730 cardinality: 190
    Cost EXTERNAL 34 NESTED LOOPS: 340 980 bytes: 235 410 cardinality: 190
    Cost EXTERNAL 31 NESTED LOOPS: 340 933 bytes: 230 090 cardinality: 190
    Cost EXTERNAL 28 NESTED LOOPS: 340 741 bytes: 226 860 cardinality: 190
    Cost EXTERNAL 25 NESTED LOOPS: 340 550 bytes: 220 970 cardinality: 190
    Cost EXTERNAL 22 NESTED LOOPS: 340 536 bytes: 217 550 cardinality: 190
    Cost EXTERNAL 19 NESTED LOOPS: 340 535 bytes: 205 770 cardinality: 190
    Cost EXTERNAL 16 NESTED LOOPS: 340 344 bytes: 202 540 cardinality: 190
    Cost EXTERNAL LOOPS IMBRIQUEES 13: 340 329 bytes: 199 120 cardinality: 190
    Cost 10 NESTED LOOPS: 340 328 bytes: 188 100 cardinality: 190
    Cost EXTERNAL 7 NESTED LOOPS: cardinality 3 bytes: 68: 1
    Cost EXTERNAL NESTED LOOPS 4: 02:00 cardinality: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_TXN cost 2: 02:00 cardinality: 1
    1 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_TXN SCAN cost: cardinality 1: 1
    3 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO SCAN cost: cardinality of 0 bytes: 58 815: 6 535
    TABLE ACCESS BY INDEX ROWID OFS_V3_4.R_AU cost TABLE 6: 1 bytes: 301 140: 10 755 cardinality
    5 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_AU SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE cost OFS_V3_4.R_TXN_PRO_STO 9: 340 325 bytes: 71 820 cardinality: 190
    8 INDEX FULL SCAN INDEX OFS_V3_4.TXN_PRO_STO__NO_LIN_IX cost: 1 285: 547 206 cardinality
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO cost 12: 1 bytes: cardinality 1: 58
    11 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO SCAN cost: cardinality 0: 1
    TABLE 15 ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO_TYP cost: 1 bytes: cardinality 18: 1
    14 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO_TYP SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_GEO_STR cost 18: 1 bytes: cardinality 1: 17
    17 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_GEO_STR SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO cost 21: 1 bytes: cardinality 62: 1
    20 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO_TYP cost 24: 1 bytes: cardinality 18: 1
    23 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO_TYP SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_CO cost 27: 1 bytes: cardinality 1: 31
    26 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_CO SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_GEO_STR cost 30: 1 bytes: cardinality 1: 17
    29 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_GEO_STR SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_AU cost 33: 1 bytes: cardinality 1: 28
    32 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_AU SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_AU cost 36: 1 bytes: cardinality 1: 28
    35 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_AU SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_PAC cost 39: 1 bytes: cardinality 1: 47
    38 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_PAC SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_PRO_VEN_DET cost 42: 33 octets: 33 cardinality: 1
    41 INDEX RANGE SCAN INDEX OFS_V3_4.STO__PRO_VEN_DET_FK cost: cardinality 1: 457
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_VEN_PRO_CAT cost 45: 1 bytes: cardinality 1: 32
    44 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_VEN_PRO_CAT SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_VEN_DET cost 48: 1 bytes: cardinality 1: 9
    47 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_VEN_DET SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO_PRO cost 51: 1 bytes: cardinality 1: 98
    50 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO_PRO SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_STO_PRO cost 54: 1 bytes: cardinality 1: 112
    53 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_STO_PRO SCAN cost: cardinality 0: 1
    TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_SRP cost 57: 1 bytes: cardinality 1: 19
    56 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_SRP SCAN cost: cardinality 0: 1
    60 TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_PRO cost: cardinality of 2 bytes: 71: 1
    59 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_PRO SCAN cost: cardinality 1: 1
    63 TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_SRP cost: 1 bytes: cardinality 1: 19
    62 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_SRP SCAN cost: cardinality 0: 1
    66 TABLE ACCESS BY INDEX ROWID TABLE OFS_V3_4.R_PAR_TYP cost: 1 bytes: cardinality 1: 10
    65 INDEX UNIQUE INDEX (SINGLE) OFS_V3_4.PK_PAR_TYP SCAN cost: cardinality 0: 1

    Except for the fact that the tables listed in the two execution plans are totally different, I can see that the two database have a different place (ALL_ROWS vs FIRST_ROWS) optimizer.

    In addition, there is a big difference in the number of rows processed every step of execution.

  • rownum hurt Oracle explain plan

    SCOTT@oracle10g>create table t as select * from dba_objects;
    
    Table created.
    
    SCOTT@oracle10g>alter table t modify CREATED date not null;
    
    Table altered.
    
    SCOTT@oracle10g>insert into t select * from t;
    
    50416 rows created.
    
    SCOTT@oracle10g>insert into t select * from t;
    
    100832 rows created.
    
    SCOTT@oracle10g>insert into t select * from t;
    
    201664 rows created.
    
    SCOTT@oracle10g>commit;
    
    Commit complete.
    
    SCOTT@oracle10g>create index t_created on t(created) nologging;
    
    Index created.
    
    SCOTT@oracle10g>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    
    
    SCOTT@oracle10g>set autot trace 
    SCOTT@oracle10g>select t.owner,t.object_name   from 
      2  (select rid from (
      3  select rownum rn,rid from 
      4  (select rowid rid from t order by created)
      5  where rownum<100035)
      6  where rn>100000) h, t
      7  where t.rowid=h.rid;
    
    34 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3449471415
    
    --------------------------------------------------------------------------------
    ---------
    
    | Id  | Operation           | Name      | Rows  | Bytes |TempSpc| Cost (%CPU)| T
    ime     |
    
    --------------------------------------------------------------------------------
    ---------
    
    |   0 | SELECT STATEMENT    |           |   100K|    11M|       |  4776   (2)| 0
    0:00:58 |
    
    |*  1 |  HASH JOIN          |           |   100K|    11M|  3616K|  4776   (2)| 0
    0:00:58 |
    
    |*  2 |   VIEW              |           |   100K|  2442K|       |  1116   (2)| 0
    0:00:14 |
    
    |*  3 |    COUNT STOPKEY    |           |       |       |       |            |
            |
    
    |   4 |     VIEW            |           |   440K|  5157K|       |  1116   (2)| 0
    0:00:14 |
    
    |   5 |      INDEX FULL SCAN| T_CREATED |   440K|  9024K|       |  1116   (2)| 0
    0:00:14 |
    
    |   6 |   TABLE ACCESS FULL | T         |   440K|    39M|       |  1237   (2)| 0
    0:00:15 |
    
    --------------------------------------------------------------------------------
    ---------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - access("T".ROWID="RID")
       2 - filter("RN">100000)
       3 - filter(ROWNUM<100035)
    
    Note
    -----
       - dynamic sampling used for this statement
    
    
    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
           5814  consistent gets
              0  physical reads
              0  redo size
           1588  bytes sent via SQL*Net to client
            422  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             34  rows processed    
    
    here ,oracle don't choose the best explain plan ,I think becase  oracle compute cadinality 100k ,so it don't choose nest loop,why oracle can't compute cardinality 35 here ??
    
    |*  2 |   VIEW              |           |   100K|  2442K|       |  1116   (2)| 0
    
    
    
    SCOTT@oracle10g>select  t.owner,t.object_name   from t where rowid in 
      2      (select rid from (
      3      select rownum rn,rid from 
      4      (select rowid rid from t order by created)
      5      where rownum<100035)
      6      where rn>100000) 
      7  
    SCOTT@oracle10g>/
    
    34 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1566335206
    
    --------------------------------------------------------------------------------
    ---------
    
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    
    --------------------------------------------------------------------------------
    ---------
    
    |   0 | SELECT STATEMENT            |           |     1 |   107 |  1586   (2)| 0
    0:00:20 |
    
    |   1 |  NESTED LOOPS               |           |     1 |   107 |  1586   (2)| 0
    0:00:20 |
    
    |   2 |   VIEW                      | VW_NSO_1  |   100K|  1172K|  1116   (2)| 0
    0:00:14 |
    
    |   3 |    HASH UNIQUE              |           |     1 |  2442K|            |
            |
    
    |*  4 |     VIEW                    |           |   100K|  2442K|  1116   (2)| 0
    0:00:14 |
    
    |*  5 |      COUNT STOPKEY          |           |       |       |            |
            |
    
    |   6 |       VIEW                  |           |   440K|  5157K|  1116   (2)| 0
    0:00:14 |
    
    |   7 |        INDEX FULL SCAN      | T_CREATED |   440K|  9024K|  1116   (2)| 0
    0:00:14 |
    
    |   8 |   TABLE ACCESS BY USER ROWID| T         |     1 |    95 |     1   (0)| 0
    0:00:01 |
    
    --------------------------------------------------------------------------------
    ---------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - filter("RN">100000)
       5 - filter(ROWNUM<100035)
    
    Note
    -----
       - dynamic sampling used for this statement
    
    
    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
            301  consistent gets
              0  physical reads
              0  redo size
           1896  bytes sent via SQL*Net to client
            422  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             34  rows processed
    
    SCOTT@oracle10g>select /*+ordered use_nl(t)*/ t.owner,t.object_name   from 
      2  (select rid from (
      3  select rownum rn,rid from 
      4  (select rowid rid from t order by created)
      5  where rownum<100035)
      6  where rn>100000) h, t
      7  where t.rowid=h.rid;
    
    34 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3976541160
    
    --------------------------------------------------------------------------------
    ---------
    
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| T
    ime     |
    
    --------------------------------------------------------------------------------
    ---------
    
    |   0 | SELECT STATEMENT            |           |   100K|    11M|   101K  (1)| 0
    0:20:16 |
    
    |   1 |  NESTED LOOPS               |           |   100K|    11M|   101K  (1)| 0
    0:20:16 |
    
    |*  2 |   VIEW                      |           |   100K|  2442K|  1116   (2)| 0
    0:00:14 |
    
    |*  3 |    COUNT STOPKEY            |           |       |       |            |
            |
    
    |   4 |     VIEW                    |           |   440K|  5157K|  1116   (2)| 0
    0:00:14 |
    
    |   5 |      INDEX FULL SCAN        | T_CREATED |   440K|  9024K|  1116   (2)| 0
    0:00:14 |
    
    |   6 |   TABLE ACCESS BY USER ROWID| T         |     1 |    95 |     1   (0)| 0
    0:00:01 |
    
    --------------------------------------------------------------------------------
    ---------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("RN">100000)
       3 - filter(ROWNUM<100035)
    
    Note
    -----
       - dynamic sampling used for this statement
    
    
    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
            304  consistent gets
              0  physical reads
              0  redo size
           1588  bytes sent via SQL*Net to client
            422  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             34  rows processed   

  • Reg papers choose to OCA/OCP

    Hello

    I want to get the Oracle certification, during my study, I knew there are three levels: OCA, OCP, OCM

    I work more on developing XML applications however PL - SQL knowledge is required:
    Certifications (OCA) Oracle path I choose: IZ0-047 (Oracle database SQL Expert), IZ0-051(Oracle Database 11g: SQL Fundamentals I) on both what is best. that beifits made one offer on the other.

    Then for PL - SQL, I have the same question, I found 2 papers (program PL/SQL 1Z0-147), (Oracle Database 11g: program with PL/SQL 1Z0-144) what benefits does it offer one on the other.

    I've also seen trace direct OCP by writing 3 exams at once, which is a good option, if I do not see in pl - sql advanced paper I reward certificate OCA?

    Thanks in advance,

    Kind regards
    Sreekanth.J.U.P

    user11121923 wrote:
    Thanks Ken,

    You are welcome

    I think a lot of practice and knowledge for the review of Expert SQL

    Exactly!

    you kindly can refer all resources for the preparation to IZ0 - 047.

    I think he had discussions here in OTN associated with this review

    Also, OCÉ, OCA means the same thing right?

    N °

    OCÉ - Oracle Certified Expert
    BC - Oracle Certified Associate

    - - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev a. (10g OCP)
    http://kamranagayev.WordPress.com
    [Step by step installation Oracle Linux and automate the installation by using Shell Script | http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Oracle 11G demobld.sql Script...

    I have a colleague asked me to install the demo tables that Oracle used to provide (for example, scott/tiger HR, EMPL and other tables, but I don't seem to be able to find the demobld.sql script in the old location ($OH/sqlplus/demo).)

    Oracle still offers a simple demo for developers and others to learn SQL?

    Also, I used to have an old book (probably from Oracle 7) Oracle who gave examples of the use of the demo tables owned by scott.
    This book was actually written by Oracle and probably handed to me in one of the old Oracle SQL 7 training classes.
    Does anyone know if something like this exists for Oracle 11 G.

    So far I found only scripts under $OH/rdbms/demo, but I do not know what scripts to run, or in what order.

    Thanks in advance for your help.

    JI Li

    According to the doc 11 g
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28328/scripts.htm
    "You need to install the basic examples of Oracle data from media to fill the directories with the example of schema scripts"
    Examples of database Oracle is the new name of companion.
    You can download it from http://download.oracle.com then choose your platform, then click "Show all", you will see Oracle Database 11 g examples (formerly companion)

    Nicolas.

Maybe you are looking for

  • Satellite M100-165 - need drivers in Windows XP Home edition

    Any body please help me where can I download a newer driver for my laptop Toshiba Satellite M100-1211E (PSMAAL - 01 P 004) run with Window XP SP2 comfortable, when I use Windows Vista, driver it is OK but use with Window XP driver fail to function as

  • Tecra M3: Fan is not off even not running progams

    Hello I have a laptop Toshiba Tecra M3 PTM30E for a month, it's wonderful BUT,.The fan does not stop and this sound is noisy in comparison with other laptops that I have and it warm up. Once the laptop warm up after a few second the fan on and even s

  • Satellite L505 recover with disks

    Hello. I tried to restore my laptop to factory settings for the last 2 days at the end of the second disc, I got an error ff00-f3-0006 and it forces me to me will close.I have the drivers and programs disk to retrieve the disk hard if that's the prob

  • Printing on DVD or CD with the HP Officejet Pro 8600?

    Is it possible and where can I find guidelines to run CD or DVD printing?

  • Ink laser jet pro 200: numbers of HP photo paper

    What are the numbers of HP Paper Photo quality for printing my color Laser printer?  I'm having a hard time finding just the photo Laser paper.  Everything seems to be for inkjet.  I think that HP made the printer, they probably have the book I need