Merge Vs Update with Subquery

What is the main difference between Merge Statment(only update) with simple Update statement based on Select query ?
Which one is faster ?

There are no vanilla answers to such a question especially when asked by someone who doesn't have time to post version number or DML.
The only honest answer ... build a test environment and test it using EXPLAIN PLAN and SET TIMING ON.
That said: A merge statement should only be used where it is appropriate.

Similar Messages

  • Update with subquery

    I want to update a table with data extracted from a xmltype.
    But Oracle extracts only the first value from the subquery.
    Am I missing something or this is the expected output...
    drop table t
    create table t(id number, val varchar2(20));
    insert into t(id, val) values (1, null)
    insert into t(id, val) values (2, null)
    select *
    from t
    ID     VAL
    1     
    2     
    update t set(val) =
    (select t.id from dual)
    where id = t.id
    select *
    from t
    ID     VAL
    1     1
    2     2
    update t set(val) =
    (select extractValue(
                   extract(xmltype('<root>'||
                                       '<node id="1">'||
                                       '<value>1</value>'||
                                       '</node>'||
                                       '<node id="2">'||
                                       '<value>2</value>'||
                                       '</node>'||
                                       '</root>'),
                             '//root/node[@id='||to_char(t.id)||']'),
                   '/node/value') from dual)
    where id = t.id
    select *
    from t
    ID     VAL
    1     1
    2     1 -- <-- should be 2!

    Hi,
    try this way:
    SQL> CREATE TABLE tab AS SELECT 1 id,cast(NULL AS VARCHAR2(20)) val FROM dual UNION ALL
      2                      SELECT 2,NULL FROM dual;
    Table created.
    SQL> DESC tab;
    Name                                      Null?    Type
    ID                                                 NUMBER
    VAL                                                VARCHAR2(20)
    SQL>
    SQL> SELECT * FROM tab;
            ID VAL                                                                 
             1                                                                     
             2                                                                     
    SQL>
    SQL> UPDATE tab t
      2  SET val=(
      3      SELECT
      4         extractValue(
      5            extract(
      6               XMLType('<root>
      7                          <node id="1">
      8                            <value>1</value>
      9                          </node>
    10                          <node id="2">
    11                            <value>2</value>
    12                          </node>
    13                        </root>')
    14               ,'/root/node[@id='||id||']')
    15            ,'/node/value') va
    16      FROM tab s
    17    WHERE t.id=s.id) ;
    2 rows updated.
    SQL> SELECT * FROM tab;
            ID VAL                                                                 
             1 1                                                                   
             2 2                                                                   
    SQL> spool off;btw, you don't need to || every line in xml, and you don't need to do to_char() when using ||
    Ants

  • Update with subquery in TopLink ?

    I want to activate the user account updating its status to ACTIVE.
    UPDATE PujUserEntity as user SET user.status.id = (SELECT status.id from PujUserStatusEntity status WHERE status.tag='ACTIVE') WHERE user.login= :login AND user.email= :email
    the error during the deployment on Glassfish (TopLink):
    CLI171 Command deploy failed : Deploying application in domain failed;
    Exception Description: Syntax error parsing the query [activateUserAccount: UPDATE PujUserEntity as user SET user.status.id = (SELECT status.id from PujUserStatusEntity status WHERE status.tag='ACTIVE') WHERE user.login= :userLogin AND user.email= :userEmail], line 1, column 52: unexpected token [SELECT].
    Internal Exception: line 1:52: unexpected token: SELECT

    According to JPA specification you are not allowed to use subquery in that place. In SET part you can only use simple_arithmetic_expression | string_primary | datetime_primary | boolean_primary | enum_primary | simple_entity_expression | NULL (JSR 220 Java Persistence API specification page 104). You should be able to use native query, or find status.id first and then just pass it as parameter.

  • Insert / update with subquery

    Hi,
    i have to insert (if records don't exist) or update (if records already exist) records from table S into table D. S and D have the same structure.
    Table S
    ID NUMBER, Primary Key,
    DESC1 VARCHAR
    DESC2 VARCHAR
    Table D
    ID NUMBER, Primary Key,
    DESC1 VARCHAR
    DESC2 VARCHAR
    Are this statements OK?
    INSERT INTO D
    ( SELECT * FROM S T1 WHERE NOT EXISTS
    ( SELECT '1' FROM D T2 WHERE T2.ID = T1.ID));
    UPDATE D T1
    SET (DESC1, DESC2) =
    (SELECT DESC1, DECS2
    FROM S T2 WHERE T1.ID = T2.ID ) WHERE EXIST
    ( SELECT '1' FROM S T3 WHERE T1.ID = T3.ID );
    Thanks a lot

    Depends on exist or not the data in
    the destination where id doesn't exists in the source.
    SQL> select * from updatable_tab;
    ID DESC1 DESC2
    1 0 0
    1 0 0
    1 0 0
    1 0 0
    2 f f
    2 f f
    2 f f
    2 f f
    2 f f
    9 rows selected.
    SQL> update updatable_tab dst set (desc1, desc2) =
    2 (select desc1, desc2 from s where s.id = dst.id)
    3 /
    9 rows updated.
    SQL> select * from updatable_tab;
    ID DESC1 DESC2
    1 A A
    1 A A
    1 A A
    1 A A
    2 B B
    2 B B
    2 B B
    2 B B
    2 B B
    9 rows selected.
    But if you have the row in the destination table
    wich does not exists in the source table, it will
    nullify your dest1 and dest2.
    In this case you should of course:
    SQL> select * from updatable_tab;
    ID DESC1 DESC2
    1 0 0
    1 0 0
    1 0 0
    1 0 0
    2 f f
    2 f f
    2 f f
    2 f f
    2 f f
    3 m m
    10 rows selected.
    SQL> select * from s;
    ID DESC1 DESC2
    1 A A
    2 B B
    SQL> update updatable_tab dst set (desc1, desc2) =
    2 (select desc1, desc2 from s where s.id = dst.id)
    3 where exists (select null from s where s.id = dst.id)
    4 /
    9 rows updated.
    SQL> select * from updatable_tab;
    ID DESC1 DESC2
    1 A A
    1 A A
    1 A A
    1 A A
    2 B B
    2 B B
    2 B B
    2 B B
    2 B B
    3 m m
    Rgds.

  • Update with exists and subquery

    Hi how to pass index to this sql
    Table pap ( eqid,seq,histseq,docno,status,value1,value2)
    PK(eqid,seq,histseq) and indx (docno)
    table pa ( eqid,seq,docno,status,value1,value2)
    PK(eqid,seq) and indx (docno)
    update pa
    set (value1,value2) = (select pap.value1,pap.value2 from pap
    where pap.eqid = pa.eqid
    and pap.seq = pa.seq
    and pap.histseq =1
    and pap.docno <> pa.docno
    and pap.status = 4 )
    where pa.status=1
    and exists ( select 1 from pap
    where pap.eqid = pa.eqid
    and pap.seq = pa.seq
    and pap.histseq =1
    and pap.docno <> pa.docno
    and pap.status =4 )
    It is doing fulltable scan on pa and using hash join .
    How to write update with subquery method also ?

    There's nothing wrong with a full scan.
    Please read this explanation/example: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:9422487749968
    If you want more explanation then please follow these guidelines below, so we have sufficient inputs:
    [When your query takes too long...|http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597]
    [How to post a SQL statement tuning request|http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0]
    Remember to put the tag befor and after the examples you post.
    See http://forums.oracle.com/forums/help.jspa regarding tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Update column with subquery returning more than one row

    Hi Everybody,
    Please let me know how to handle this. I am writing update statement in procedure with subquery and it is returning multiple rows. Please help me, how i can handle this :
    UPDATE TABLEA A
    SET A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id)
    WHERE A.id = (Select B.id from TABLEB B, TABLEA A WHERE B.id = A.id);
    (Select B.XERROR_MESSAGE from TABLEB B, TABLEA A WHERE B.id = A.id) --- This subquery is returning more than one rows. How i can handle this in Pl/SQL?
    Please let me know. I will be very thankful to you all.
    I will really appreciate your replies and comments.
    Thank you

    Try getting rid of tablea in your subqueries. You already have it in the UPDATE statement.
    UPDATE TABLEA A
    SET    A.ERROR_MESSAGE = (Select B.XERROR_MESSAGE
                              from   TABLEB B
                              WHERE  B.id = A.id
    WHERE  A.id = (Select B.id
                   from   TABLEB B
                   WHERE  B.id = A.id);You can also try a simple MERGE:
    merge into tablea a
    using tableb b
    on    (a.id = b.id)
    when  matched then update
          set a.error_message = b.xerror_message;

  • After moving my itunes library from my old WinXP computer to my new Win7 computer, itunes gives a warning that my content on my phone must be removed and re-synced. I want to merge changes/updates on my phone with my itunes library as normal, not erase it

    After moving my itunes library from my old WinXP computer to my new Win7 computer, itunes gives a warning that my content on my phone must be removed and re-synced. I want to merge changes/updates on my phone with my itunes library as normal, not erase it & replace it. My updates/changes will be lost.
    How do I merge content on my iPhone & content in iTunes together?

    Hopefully you still have the original library and can redo the migration...
    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Note if you have iOS devices and haven't moved your contacts and calendar items across then you should create one dummy entry of each in your new profile and iTunes should  merge the existing data from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

  • MERGE statement - Source with duplicate values not raising error ora-30926

    Hi ,
    I'm having a problem with merge that has already been reported in another thread ( Re: MERGE strange behavior ). I created a procedure with a query and have tested inserting two equal values on the Key column to raise the error. But on the first time there i run the Procedure it runs without error, apparently updating with the first row found. On the second time there i run the procedure then Oracle raises the error.
    Above you can see the code to simulate the issue:
    -- creating the table
    create TABLE teste
    ( ID NUMBER NOT NULL , DESCR VARCHAR2 (20 CHAR) , GRUPO VARCHAR2 (30 CHAR) );
    -- inserting the pk in table
    ALTER TABLE Teste
    ADD CONSTRAINT DimTestec_PK PRIMARY KEY ( ID ) ;
    -- inserting records in the table
    insert into teste
    select -2 AS id,'t-2' AS descr,'t-2g' AS grupo from dual
    union all
    select -1 AS id,'t-1' AS descr,'t-1g' AS grupo from dual
    union all
    select 1 AS id,'t1' AS descr,'t1g' AS grupo from Dual
    union all
    select 2 AS id,'t2' AS descr,'t2g' AS grupo from Dual
    union all
    select 3 AS id,'t3' AS descr,'t3g' AS grupo from Dual
    union all
    select 4 AS id,'t4' AS descr,'t4g' AS grupo from Dual
    union all
    select 5 AS id,'t5' AS descr,'t4g' AS grupo from Dual
    --create the procedure to teste the merge
    create or replace procedure mergeteste is
    Begin
    MERGE INTO teste testemerge
    USING ( select -2 AS id,'t-2' AS descr,'t-2g' AS grupo from dual
    union all
    select -1 AS id,'t-1' AS descr,'t-1g' AS grupo from dual
    union all
    select 1 AS id,'t1' AS descr,'t1g' AS grupo from Dual
    union all
    select 2 AS id,'t2' AS descr,'t2g' AS grupo from Dual
    union all
    select 3 AS id,'t3' AS descr,'t3g' AS grupo from Dual
    union all
    select 4 AS id,'t4' AS descr,'t4g' AS grupo from Dual
    union all
    select 5 AS id,'t5' AS descr,'t4g' AS grupo from Dual
    union all
    select 5 AS id,'t6' AS descr,'t6' AS grupo from Dual ) testesource
    ON (testemerge.id = testesource.id)
    WHEN MATCHED THEN
    UPDATE SET testemerge.descr = testesource.descr,
    testemerge.grupo = testesource.grupo
    WHEN NOT MATCHED THEN
    INSERT ( testemerge.id, testemerge.descr, testemerge.grupo )
    VALUES ( testesource.id, testesource.descr, testesource.grupo ) ;
    commit work;
    EXCEPTION
    WHEN OTHERS THEN
    begin
    ROLLBACK;
    dbms_output.put_line(dbms_utility.format_error_stack||dbms_utility.format_error_backtrace);
    end;
    end mergeteste;
    -- the first time you execute the procedure, it runs without error - when it shouldn't run cause there's two id with value 5 on the testesource query.
    -- the second time it raises the expected error.
    Here's the oracle version:
    1 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    2 PL/SQL Release 11.2.0.3.0 - Production
    3 CORE 11.2.0.3.0 Production
    4 TNS for Linux: Version 11.2.0.3.0 - Production
    5 NLSRTL Version 11.2.0.3.0 - Production
    Thanks in advance.
    Best Regards.
    Renan Ribeiro

    Hi, Renan,
    That sounds like a bug. In Oracle 11.1, I get the error the first time I run the procedure, but in Oracle 11.2, I get the same results you do (that is, no error the first time I run the procedure, error the second time).

  • Is there a way to create a file merge that updates from the original source file if changes are made?

    I have thousands of PDF documents that are merged with other files. I'll give an example so it's easier to understand.
    File #1 may be merged (or in a portfolio) with Files #2 and #3 but also in another merge (or portfolio) with Files #3 and #4.
    If I update File #1, is there a way for it to automatically update both of the merge or portfolio files with the updated File #1? (File#1 would be replaced, same name and location).
    I'm using windows and Adobe Acrobat Pro

    You would need to add favorites to the WebHelp output prior to creating a CHM. You would need something along the lines of: http://www.wvanweelden.eu/product/favorites-widget-webhelp
    But since it's in a CHM, I'm not sure whether you will be able to save anything from the webhelp output between sessions.
    Kind regards,
    Willam

  • Update with a select statement

    hi experts,
    I need some help again.. :)
    I have an insert query here with a select statement.. Juz wondering how to do it in update?
    insert into newsmail_recipient
            (IP_RECIPIENTID,NF_LISTID,NF_STATUSID,D_CREATED,D_MODIFIED,C_NAME,C_EMAIL,USER_ID,NEWSMAIL_ID)
            select newsmail_recipientid_seq.nextval
              , liste
              , 1
              , sysdate
              , sysdate
              , null
              , null
              , ru.nf_userid
              , null
            from roleuser ru, unit u, userinfo ui
            where u.ip_unitid = ru.nf_unitid
            and u.ip_unitid = unit_id
            and ui.ip_userid = ru.nf_userid
            and ui.nf_statusid = 1
            and n_internal = 0
            and ui.ip_userid not in (select user_id
                                       from newsmail_recipient
                                      where user_id = ui.ip_userid
                                        and nf_listid = liste
                                        and nf_statusid = 1);let me know your thoughts.
    Regards,
    jp

    Hi,
    924864 wrote:
    ... I have an insert query here with a select statement.. Juz wondering how to do it in update?How to do what, exactly?
    MERGE can UPDATE existing rows, and INSERT new rows at the same time. In a MERGE statement, you give a table or a sub-query in the USING clause, and define how rows from that result set match rows in your destination table. If rows match, then you can UPDATE the matching row with values from the sub-query.
    Very often, MERGE is easier to use, and perhaps more efficient, than UPDATE just for changing existing rows. That is, while MERGE can do both INSERT and UPDATE, it doesn't have to . You can tell MERGE just to do one or the other if you wish.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Since you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Update with Outer Join

    Is it possible to do an update that involves an outer join on the table being updated?
    Here's what I mean - currently, I have something like:
    UPDATE table_1 t1
    SET col_1 =
    SELECT t2.col_2
    FROM table_2 t2
    WHERE t2.t1_key = t1.t1_key
    WHERE EXISTS
    SELECT t2.*
    FROM table_2 t2
    WHERE t2.t1_key = t1.t1_key
    UPDATE table_1 t1
    SET col_1 = 0
    WHERE NOT EXISTS
    SELECT t2.*
    FROM table_2 t2
    WHERE t2.t1_key = t1.t1_key
    Yes, I could do set all of the table_1.col_1 values = 0 first, and then do the first update, but it is inefficient given the number of records in the table that would be updated twice.
    Is there a way of combining these two updates into a single update statement?

    You could simply use your first update and omit the WHERE EXISTS clause since you want to update all the rows in table_1 anyway.
    If the subquery finds a match, it will update with the selected value. Normally, a non-match would set the column to a null but you can solve that with NVL:
    SQL> select * from table_1;
                  T1_KEY                COL_1
                       1                    1
                       2                    1
                       3                    1
                       4                    1
                       5                    1
                       6                    1
                       7                    1
                       8                    1
                       9                    1
    9 rows selected.
    SQL> select * from table_2;
                  T2_KEY                COL_2
                       1                    9
                       3                    9
                       5                    9
    SQL> UPDATE table_1 t1
      2  SET    col_1 = nvl (
      3                       (SELECT t2.col_2
      4                        FROM   table_2 t2
      5                        WHERE  t2.t2_key = t1.t1_key
      6                       ),0
      7                     )
      8  ;
    9 rows updated.
    SQL> select * from table_1;
                  T1_KEY                COL_1
                       1                    9
                       2                    0
                       3                    9
                       4                    0
                       5                    9
                       6                    0
                       7                    0
                       8                    0
                       9                    0
    9 rows selected.

  • (SOLVED) Trouble merging .pacnew files with meld

    Dear Archers
    Unable to merge .pacnew files, following the example on ArchWiki. Only, the difference between the two files shown
    [root@KRISHNA san2ban]# #!/bin/bash
    [root@KRISHNA san2ban]# # pacnew-update - merge *.pacnew files with original configurations with meld
    [root@KRISHNA san2ban]#
    [root@KRISHNA san2ban]# pacnew=$(find /etc -type f -name "*.pacnew")
    [root@KRISHNA san2ban]#
    [root@KRISHNA san2ban]# for config in $pacnew; do
    > # Merge with meld
    > gksu meld ${config%\.*} $config &
    > wait
    > done
    [1] 1578
    GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: The connection is closed)
    GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: The connection is closed)
    Also, on the Archwiki, we are advised to change 'kdesu' to 'gksudo' for GNOME, but I think it should be gksu
    Last edited by San2ban (2011-08-18 14:07:53)

    San2ban wrote:
    Dear Karol
    Thanks. yes, manual intervention is needed
    Wonder how it will be without you guy's guiding us
    You bet your ass, manual intervention is needed. If you try to blindly just merge *.pacnew with original files, it might lead to an unbootable system. Especially when you get pacnew files for /etc/group and /etc/inittab

  • S015 Update with budat

    Hello,
    I have a problem with S015 :
    The update date is budat, but if the date (budat) is after the end date (DATBI) of rebate arrangement, S015 is update with datbi.
    So I create a new S515, it's OK for the update of receipt or invoice but, when I create a Settlement Document  (MEB4) it also take the budat...
    If you have an idea, it will welcome !
    For your information, it's to have a account visualisation and not only a logistics visualisation.
    Henri

    Untested ...
    MERGE INTO Table_A Tgt
    USING (select Table_A.rowid ri
              from Table_B,
                   Table_A
             where Table_B.colA = Table_A.colB
               and TableA.colD = 1
               and TableB.colG = 'col_Value'
               and TableA.colC = 'valid'
           ) Src
    ON (Tgt.rowid=Src.ri)
    WHEN MATCHED THEN UPDATE
    SET Tgt.colC = 'Invalid'Edited by: Ekh on May 12, 2012 9:57 AM

  • Merging local records with device records failed

    Hi,
    I have a macbook with OS X 10.4.11 (Intel procesor)  I did install the latest Pockect mac for blackberry version (the current one in the Blackberry's page), i use to use the old one, since I did the updated I can't get that both, device and Mac SYNC any item, no contacts, no calendar... 
    The message I got last time was: 
    06:06:57:140 merging local records with device records failed. 
    Could some one with me a light on this bug?
    Thanks 

    Hi rguardia,
    Can you try synching one PIM database at a time, e.g. just Contacts by itself, so we can determine which database is experiencing the problem?  The error you are receiving is likely being caused by one specific database.
    Once you have identified the database that is causing problems, can you perform the steps listed below:
    1 - Run Data Purge on the affected database.  Data purge can be found in the following location: 
    Mac HD/users/<Home User>/Library/Application Support/PocketMacSyncManager/Additional Tools. 
    ***Please note this utility will delete all information stored in the selected database on your BlackBerry however once the information has been deleted from your device you can reimport the data to your BlackBerry from the application on your Mac.
    2 - Run Sync Clean, which can be found in the same folder as Data Purge. 
    3 - Disconnect the BB from the Mac, remove the battery from the back of the device, wait 10 seconds then reinsert it
    4 - Reboot the Mac
    5 - Reconnect your BlackBerry to your Mac
    6 - Open PocketMac and select Reset All Devices to First Sync State from the Devices menu
    7 - Configure synchronization settings for the affected PIM database, choosing the option to Overwrite Device.  If the data is successfully transferred to the device, reconfigure PocketMac back to doing a two-way sync.
    If you are still running into the same problem after performing the steps above, try synching one category of the affected database at a time. To do this, click on the tab of the database you are trying to sync, click on Advanced Preferences next to the selected application, and choose the option to sync only selected categories. Try synching with only one category selected at a time, just to see if the issue is related to data within a specific category.
    Let us know how you make out!

  • Why update with subqueries does not have cost and cardinality?

    There is update.
    update test t1 set dummy = (select dummy from test2 t2 where t1.id = t2.id);Both tables which have actual statistics. Each has 1000 rows. And column ID have values from 1 to 1000 in each table.
    This is explain plan
    | Id  | Operation          | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT   |       |  1000 | 13000 |   426   (9)| 00:00:01 |
    |   1 |  UPDATE            | TEST  |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| TEST  |  1000 | 13000 |   426   (9)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| TEST2 |     1 |    13 |   426   (9)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("T2"."ID"=:B1)We can see here, that Oracle consider subquery within update as once-executed subquery.
    This is runtime plan
    | Id  | Operation          | Name  | Starts | E-Rows | A-Rows |
    |   1 |  UPDATE            | TEST  |      1 |        |      0 |
    |   2 |   TABLE ACCESS FULL| TEST  |      1 |   1000 |   1000 |
    |*  3 |   TABLE ACCESS FULL| TEST2 |   1000 |      1 |   1000 |
    Predicate Information (identified by operation id):
       3 - filter("T2"."ID"=:B1)Why first plan does not have cost in step 1?
    Does Oracle always not understand that update with subqueries will performed as NL or filter? In other words that step 3 will executed many times.
    Or it is my bug (or what?)?

    793769 wrote:
    Does Oracle always not understand that update with subqueries will performed as NL or filter? In other words that step 3 will executed many times.
    Or it is my bug (or what?)?It's not possible to say whether this is a bug or a deliberate choice.
    Because of "subquery caching" (see http://jonathanlewis.wordpress.com/2006/11/06/filter-subqueries/ ) the optimizer cannot predict how often the subquery will have to run. So possibly it shows nothing rather than showing the best or worst cases or a pure guess.
    Regards
    Jonathan Lewis

Maybe you are looking for

  • Is anything run automatically?

    I'm trying out all the various options for DEs/WMs, and I'm wondering if there's any drawbacks to having multiples installed other than disk space. So is anything going to be using my cpu/ram or slowing down my boot time assuming that I don't have gd

  • Install Problem "Error: -48  The operation could not be completed... "

    I am unable to install the "Take Picture Action Installer" from http://automator.us/downloads.html#1026 The error message is "Error: -48. The operation could not be completed because there is already an item with that name." However I created a test

  • Set Session Variable

    Hello, Anyone know how to set a session variable from data entered within a messageTextInput field from a uix page within a JHeadstart application? I tried to trigger an event to write the session but was unsuccessful. Any ideas? -Jeff

  • Event Viewer System warnings.

    Hi all, just wondering if someone has heard of this and found a correction for it.In my event viewer I occasionally get a "remote access" warning message http://i588.photobucket.com/albums/ss324/DanS_photo_09/AccessError.jpg . These "remote access at

  • Function pointer question

    ok, let it be known that I am generally a c++ programmer, so some parts of c I am a bit unfamiliar with.  this generally includes generic (un-typesafe) casting and things of that nature (as c++ is supposed to be typesafe). So here's my question.  I'm