Append hints in insert query

Hi,
I want to know the difference between insert /*+ APPEND NOLOGGING PARALLEL */ into tablename and insert /*+ APPEND */ into tablename. Also, which hint will make the performance faster and in which conditions.
Also, anu URL given as reference for the same will be highly appreciated.

It's wrong, there is no NOLOGGING hint. I notice it doesn't say what it's supposed to do.
See Metalink note 826893.1 (mentioned by Jonathan Lewis here.
Edited by: William Robertson on May 30, 2011 8:36 AM

Similar Messages

  • Insert with APPEND hint

    Hello,
    I have insert statment with APPEND hint. Here statment is as follows.
    INSERT /*+ APPEND */ INTO TEST SELECT * FROM EMP;
    The TEST table is in NOLOGGING mode.
    The table has FK constraint, trigger, index too. Obvisiouly, it would not write the data in redo log. Still does it insert the data above HWM.
    Thanks.

    When you use APPEND hint with INSERT, oracle never bother about the free blocks which are below HWM. It always writies in new blocks, i.e. above HWM.
    Jaffar

  • Append hint..

    Hi all..
    Please help me with the following quesion.
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64biI have the following scenario.
    Job1 "insert" the data into "Table1".
    Job1 Insert commands has ""append hint" in it. Job1 has lot of "Inserts with append hint" that
    inserts the data into "table1".
    Job2 "inserts" the data into "Table1" only.
    Job2 insert command doesn't have append hint.
    If both job1 and job 2 ""runs parallely"", do the ""append"" hint blocks the other jobs.
    Does append hint give any problem in this scenario?
    please let me know.

    >
    If both job1 and job 2 ""runs parallely"", do the ""append"" hint blocks the other jobs.
    Does append hint give any problem in this scenario?
    >
    Direct-path insert will lock the segment. No concurrent DML is allowed. So the second job cannot insert until the direct-path insert is completed and a commit or rollback is performed.
    If job 2 starts first and is already doing DML then job1 will run but it will NOT use direct-path insert even though the APPEND hint is used.
    See this other thread from this morning.
    Insert Into Select with APPEND hint

  • --+APPEND Hint -- advantages and disadvantages in OLTP system

    I have a process in with an insert statement takes a lot of time. When I modify the insert statement to use --+ APPEND hint the insert time reduces a lot. There are a lot of indexes on this table and the table and indexes are in logging mode.
    Can someone please clarify is using +APPEND hint will have any disadvantage in an OLTP system . Will any data be lost in case of failure?
    Thanks a lot!!

    Jim,
    Append means two things: 1) don't generate redo if possible, 2) don't run around looking through freelists for existing blocks into which a stray row or three could fit, just insert the rows into new empty blocks.
    The OP stated that the table is in logging mode. This means that the insert/append will be logged and hence the transaction is recoverable. It also means that append doesn't get rid of redo generation, it only gets rid of the freelist overhead.
    I'll create a table that occupies multiple blocks:
    SQL> create table t as
      2  select * from user_objects;
    Table created.
    SQL> insert into t
      2  select * from t;
    58 rows created.
    SQL> /
    116 rows created.
    SQL> /
    232 rows created.
    SQL> /
    464 rows created.
    SQL> select rowid_block, count(*) cnt
      2    from (
      3  select dbms_rowid.rowid_block_number(rowid) AS rowid_block
      4    from t
      5         )
      6   group by rowid_block;
    ROWID_BLOCK        CNT
          32542         58
          32543        183
          32544        183
          32545        183
          32546        183
          32547        138
    6 rows selected.Then I'll empty most of the rows out of those blocks:
    SQL> delete from t
      2   where object_id != 32217;
    912 rows deleted.
    SQL> select rowid_block, count(*) cnt
      2    from (
      3  select dbms_rowid.rowid_block_number(rowid) AS rowid_block
      4    from t
      5         )
      6   group by rowid_block;
    ROWID_BLOCK        CNT
          32542          1
          32543          4
          32544          3
          32545          3
          32546          3
          32547          2
    6 rows selected.Then I'll perform a "normal" bulk insert and we'll see the data added to an existing block:
    SQL> insert into t
      2  select * from t;
    16 rows created.
    SQL> select rowid_block, count(*) cnt
      2    from (
      3  select dbms_rowid.rowid_block_number(rowid) AS rowid_block
      4    from t
      5         )
      6   group by rowid_block;
    ROWID_BLOCK        CNT
          32542          1
          32543          4
          32544          3
          32545          3
          32546          3
          32547         18
    6 rows selected.However, a bulk insert/append will use a new block -- bypassing the freelist:
    SQL> insert /*+ append */ into t
      2  select * from t;
    32 rows created.
    SQL> commit;
    Commit complete.
    SQL> select rowid_block, count(*) cnt
      2    from (
      3  select dbms_rowid.rowid_block_number(rowid) AS rowid_block
      4    from t
      5         )
      6   group by rowid_block;
    ROWID_BLOCK        CNT
           2133         32
          32542          1
          32543          4
          32544          3
          32545          3
          32546          3
          32547         18
    7 rows selected.Scott

  • How to insert APPEND hint.

    Is there a way to do /*+ APPEND */ hint in the insert statement in the OWB mapping? How do I do it?

    There are hints for both extraction and loading in the map's configuration for each table operator. Configure the mapping, expand the tree under Table Operators, the table name and you should see Extraction hint and Loading hint.
    Cheers
    David

  • Insert Query

    Hi,
    I am inserting million rows in a table using select query .
    I want to commit ...every 10000 rows
    how this is possible ?
    thanks
    Mani

    If there is such a hint it's definitely not documented and I can't get it to work.
    A quick test:
    APPEND vs APPEND NOLOGGING
    SQL> create table t as select * from dba_objects where 54 = 42;
    Table created.
    SQL> set autotrace trace stat
    SQL> insert /*+ APPEND NOLOGGING */ into t select * from dba_objects;
    72514 rows created.
    Statistics
            793  recursive calls
           1712  db block gets
           2006  consistent gets
              2  physical reads
          56404  redo size
            903  bytes sent via SQL*Net to client
           1032  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          72514  rows processed
    SQL> truncate table t;
    Table truncated.
    SQL> insert /*+ APPEND */ into t select * from dba_objects;
    72514 rows created.
    Statistics
            794  recursive calls
           1713  db block gets
           2006  consistent gets
              2  physical reads
          56464  redo size
            904  bytes sent via SQL*Net to client
           1022  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          72514  rows processed
    SQL> truncate table t;
    Table truncated.
    NOLOGGING vs insert statement with no hint
    SQL> insert into t select * from dba_objects;
    72514 rows created.
    Statistics
            453  recursive calls
           9340  db block gets
           3796  consistent gets
              0  physical reads
        8412544  redo size
            920  bytes sent via SQL*Net to client
           1008  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              6  sorts (memory)
              0  sorts (disk)
          72514  rows processed
    SQL> insert /*+ NOLOGGING */ into t select * from dba_objects;
    72514 rows created.
    Statistics
            271  recursive calls
           9371  db block gets
           3775  consistent gets
              0  physical reads
        8415248  redo size
            920  bytes sent via SQL*Net to client
           1025  bytes received via SQL*Net from client
              4  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          72514  rows processedThere seems to be no discernible difference in either of these cases by adding NOLOGGING to the hint.
    (this is on 11.2.0.1)

  • Insert query takes forever

    Hi
    I have this query for inserts and it never ends. I need some suggestions , can some one please help ? It will be much appreciated
    INSERT INTO PIMITEK.BENE_SEC_PCPTNT_FINAL
    SELECT P.PART_ID, MAX(TH.TSKID || TT.TSKDESC)
    FROM PIMITEK.BENE_SEC_PCPTNT P
    LEFT JOIN TSKIDENT TI
    ON SUBSTR(P.PART_ID,1,9) = SUBSTR(TI.FIELDVALUE,1,9)
    AND TI.IDCODE = 18
    AND TI.FIELDNBR = 1
    AND SUBSTR(TI.FIELDVALUE,10,1) = ' '
    LEFT JOIN COMPTSKIDENT CT
    ON SUBSTR(P.PART_ID,1,9) = SUBSTR(CT.FIELDVALUE,1,9)
    AND CT.IDCODE = 18
    AND CT.FIELDNBR = 1
    AND SUBSTR(CT.FIELDVALUE,10,1) = ' '
    JOIN TSKHIST TH
    ON (TI.TSKID = TH.TSKID
    OR CT.TSKID = TH.TSKID)
    AND TH.TSKCODE IN
    (SELECT TSKCODE
    FROM TSKTYPE
    JOIN PIMITEK.BENE_SEC_TSKTYPES
    ON TSKDESC = TASK_TYPE)
    JOIN TSKTYPE TT
    ON TH.TSKCODE = TT.TSKCODE
    WHERE P.PART_ID NOT IN (SELECT P2.PART_ID
    FROM PIMITEK.BENE_SEC_PCPTNT_FINAL P2)
    GROUP BY P.PART_ID ;
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | INSERT STATEMENT | | 1 | 229 | 611K (1)| 02:02:14 | | |
    | 1 | HASH GROUP BY | | 1 | 229 | 611K (1)| 02:02:14 | | |
    |* 2 | HASH JOIN | | 1 | 229 | 611K (1)| 02:02:14 | | |
    | 3 | NESTED LOOPS | | 1 | 218 | 611K (1)| 02:02:14 | | |
    | 4 | NESTED LOOPS | | 1 | 203 | 611K (1)| 02:02:14 | | |
    | 5 | NESTED LOOPS | | 1 | 188 | 611K (1)| 02:02:14 | | |
    | 6 | NESTED LOOPS OUTER | | 1 | 172 | 370K (1)| 01:14:11 | | |
    |* 7 | HASH JOIN OUTER | | 1 | 103 | 3443 (1)| 00:00:42 | | |
    |* 8 | HASH JOIN ANTI | | 1 | 34 | 5 (20)| 00:00:01 | | |
    | 9 | TABLE ACCESS FULL | BENE_SEC_PCPTNT | 1 | 17 | 2 (0)| 00:00:01 | | |
    | 10 | TABLE ACCESS FULL | BENE_SEC_PCPTNT_FINAL | 1 | 17 | 2 (0)| 00:00:01 | | |
    | 11 | PARTITION HASH ALL | | 528 | 36432 | 3438 (1)| 00:00:42 | 1 | 10 |
    |* 12 | TABLE ACCESS FULL | TSKIDENT | 528 | 36432 | 3438 (1)| 00:00:42 | 1 | 10 |
    | 13 | PARTITION HASH ALL | | 2445 | 164K| 367K (1)| 01:13:30 | 1 | 40 |
    |* 14 | INDEX RANGE SCAN | COMPTSKIDENTNP_IDENTIF_IDCODE | 2445 | 164K| 367K (1)| 01:13:30 | 1 | 40 |
    | 15 | PARTITION HASH ALL | | 432 | 6912 | 240K (1)| 00:48:03 | 1 | 10 |
    |* 16 | INDEX FAST FULL SCAN | TSKHIST_TSK_OP_PD_ST_AC_DP | 432 | 6912 | 240K (1)| 00:48:03 | 1 | 10 |
    | 17 | TABLE ACCESS BY INDEX ROWID| TSKTYPE | 1 | 15 | 1 (0)| 00:00:01 | | |
    |* 18 | INDEX UNIQUE SCAN | TSKTYPE_TSKCODE | 1 | | 0 (0)| 00:00:01 | | |
    | 19 | TABLE ACCESS BY INDEX ROWID | TSKTYPE | 1 | 15 | 0 (0)| 00:00:01 | | |
    |* 20 | INDEX UNIQUE SCAN | TSKTYPE_TSKCODE | 1 | | 0 (0)| 00:00:01 | | |
    | 21 | TABLE ACCESS FULL | BENE_SEC_TSKTYPES | 17 | 187 | 3 (0)| 00:00:01 | | |
    Predicate Information (identified by operation id):
    2 - access("TSKDESC"="TASK_TYPE")
    7 - access(SUBSTR("P"."PART_ID",1,9)=SUBSTR("TI"."FIELDVALUE"(+),1,9))
    8 - access("P"."PART_ID"="P2"."PART_ID")
    12 - filter("TI"."IDCODE"(+)=18 AND SUBSTR("TI"."FIELDVALUE"(+),10,1)=' ' AND "TI"."FIELDNBR"(+)=1)
    14 - access("CT"."IDCODE"(+)=18 AND "CT"."FIELDNBR"(+)=1)
    filter(SUBSTR("CT"."FIELDVALUE"(+),10,1)=' ' AND SUBSTR("P"."PART_ID",1,9)=SUBSTR("CT"."FIELDVALUE"(+),1,9))
    16 - filter("TI"."TSKID"="TH"."TSKID" OR "CT"."TSKID"="TH"."TSKID")
    18 - access("TH"."TSKCODE"="TSKTYPE"."TSKCODE")
    20 - access("TH"."TSKCODE"="TT"."TSKCODE")

    Hello,
    Seem you have partitioned table, try the query without insert statement and then instead of insert use create table as (for test purpose). you should collect stats on all the table involved in this query. How many rows you have in this followign table BENE_SEC_TSKTYPES ? Next time when you post output enclose it in between \ tag to preserve formatting for better readibility.
    You can also try using append hint and see if this speeds upINSERT /*+APPEND */  INTO pimitek.bene_sec_pcptnt_final ....
    create table mytest_table as
    SELECT p.part_id, MAX (th.tskid || tt.tskdesc)
    FROM pimitek.bene_sec_pcptnt p
    LEFT JOIN
    tskident ti
    ON SUBSTR (p.part_id, 1, 9) = SUBSTR (ti.fieldvalue, 1, 9)
    AND ti.idcode = 18
    AND ti.fieldnbr = 1
    AND SUBSTR (ti.fieldvalue, 10, 1) = ' '
    LEFT JOIN
    comptskident ct
    ON SUBSTR (p.part_id, 1, 9) = SUBSTR (ct.fieldvalue, 1, 9)
    AND ct.idcode = 18
    AND ct.fieldnbr = 1
    AND SUBSTR (ct.fieldvalue, 10, 1) = ' '
    JOIN
    tskhist th
    ON (ti.tskid = th.tskid OR ct.tskid = th.tskid)
    AND th.tskcode IN (SELECT tskcode
    FROM tsktype
    JOIN
    pimitek.bene_sec_tsktypes
    ON tskdesc = task_type)
    JOIN
    tsktype tt
    ON th.tskcode = tt.tskcode
    WHERE p.part_id NOT IN (SELECT p2.part_id
    FROM pimitek.bene_sec_pcptnt_final p2)
    GROUP BY p.part_id;
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Create table as with append hint

    All,
    This is part of my oracle plsql procedure.
    EXECUTE IMMEDIATE 'create table inventory_stg
    TABLESPACE users
    PARALLEL 6
    AS
    SELECT DISTINCT /*+ parallel(stg,6) */
    orders.order_sid,
    ORDERS.order_doc,
    stg.ref_doc_num quote_num
    FROM stg,
    ORDERS,
    QUOTE
    WHERE
    stg.DOC_doc=ORDERS.order_doc AND
    stg.ref_doc_num=QUOTE.quote_num AND
    QUOTE.s_no = ORDERS.s_no';
    This query is running for ever.
    If i create a table and insert with append hint, it will complete in 10 min.
    I know, the append hint will bypass redolog and insert above HWM.
    But my above code also a direct load and why it is taking this much time?
    My db is running in archive log mode. But i don't want to log the info in redo.
    Regards
    Govind

    I don't think so. /*+ APPEND */ is probably what you are thinking of. But even if it isn't direct load, inserting into a tablespace that isn't totally fragged might not be too slow for you. I'm just suggesting a test since you weren't getting any direct answers.
    I actually haven't done any testing on parallel with execute immediate either. I don't know if EI imposesl certain limitations on that or not.
    Anyone?
    Update: Actually, you are correct. Append is the default mode for a parallel insert. So that would make me start looking at side affects of the Execute Immediate.
    Message was edited by:
    Gaff

  • Append hint generating huge redo

    Hi all,
    Sorry if this question was already asked here.
    We have few [partitioned] tables created with no logging option. Java code [which inserts data in these tables] has /*+ Append */ hint.
    DB is 10.2.0.5 version, DB is in archive.
    When we query "sys.v_$sqlarea" and "dba_users", we do see append hint for the insert statements. But when we do log mining we don’t see append hint there, all the insert statements [huge] are making into redo log[which we don’t want], Any idea why…?
    Thanks,
    AJ

    Thanks for your replies -
    Here is my insert hint -
    INSERT /*+ Append */ INTO tab_1(SUBTYPE........
    Let me know if hint is wrong?
    Question –
    sys.v_$sqlarea shows above hint but mined redo log [archived log as well] doesn’t show hint i.e. insert statement is shown like - INSERT INTO tab_1(SUBTYPE........
    Does that mean oracle is ignoring hint [because hint is wrong, what would be the correct hint]…?
    FYI – we have cursor_sharing set to similar – will that cause an issue?
    Thanks,
    AJ.

  • Append hint + ADO + Oracle OleDB Provider

    Hi everybody!
    This is my first post here in this great forum! ;-)
    I have a problem using Append hint with Oracle OleDB Provider and I've been searching internet for an answer without any luck.
    I'm trying to use Append hint with ADO + Oracle OleDB Provider (OraOLEDB.Oracle.1), like in the SQL below:
    INSERT /*+APPEND*/
    INTO my_table(field1, field2, field3)
    SELECT 0 field1, v.field2, v.field3)
    FROM my_second_table v
    The problem: Oracle is still creting log for this INSERT (It is working like there was no Append hint).
    If I use the same SQL statement with Microsoft Ole DB Provider for Oracle, the Append hint works as expected (log is not created), but doesn't work at all with Oracle DB Provider.
    Trace shows me that the SQL sentence is ok (the append hint is there!).
    I've tried Oracle servers 9.2 and/or 10g, and the problem is the same.
    Question: Does Append hint work with Oracle OleDB Provider? If yes, why it is not working? Something related with connection properties?
    Any help will be much appreciated!
    Thanks in advance.
    Alexandre Machado

    user8010279 wrote:
    Hi Solomon, thanks for you answer.
    Is the same SQL against the same database, with the same program, using ADO + OleDB Provider.
    The table is in NOLOGGING mode.
    When I use Microsoft OleDB Provider for Oracle there is no log creation. Then I disconnect and reconnect to the same server/database, using Oracle OleDB Provider. Then I execute the same SQL and.... there IS log creation, meaning that in that scenario, append hint is being ignored. I can't figure out WHY!!! :-(
    Alexandre,
    I'm not sure what you mean by "there is log creation". In general you need to distinguish between UNDO and REDO generation. A direct-path insert (APPEND hint) doesn't generate undo but still can generate redo, depending on the ARCHIVELOG / FORCE LOGGING mode of the tablespace resp. database and the LOGGING/NOLOGGING attribute of the table.
    Note that in case indexes exist on the table there will always be undo and therefore redo generation for the index maintenance as part of the direct-path insert.
    You should check V$SESSION (SQL_ID in 10g, SQL_ADDRESS + SQL_HASH_VALUE in pre-10g) and V$SQL in the database to double check if the SQL passed by the Oracle OLEDB Provider actually contains the APPEND hint in case the INSERT actually generates UNDO (which is the indicator that shows you if the direct-path insert is used or not). Whether it generates REDO is - as already mentioned - depending on other factors.
    So the question is how have you determined if the direct-path insert mode has been used or not?
    The simplest approach to test if direct-path insert mode is used or not is to issue a query on the object inserted into after the insert before committing the transaction. If it fails with "ORA-12838: cannot read/modify an object after modifying it in parallel" then you successfully inserted using direct-path insert.
    Note that there a number of restrictions that prevent the direct-path insert from happening, in those cases the APPEND hint will be silently ignored, e.g. enabled triggers, foreign keys on the table. A quite comprehensive list of restrictions is listed in the manuals here:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/usingpe.htm#CACEJACE
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Insert query is using parallel mode

    Hi All,
    Insert query is running against below tables. It is using Parallelism as the below explain shows.
    Execution Plan
    Id  Operation  Name  Rows  Bytes  Cost (%CPU) Time  TQ  IN-OUT PQ Distrib 
    0  INSERT STATEMENT        779K(100)        
    1     LOAD TABLE CONVENTIONAL                 
    2       PX COORDINATOR                 
    3         PX SEND QC (RANDOM)  :TQ10002  4116K 443M 779K (0) 999:59:59  Q1,02  P->S  QC (RAND) 
    4           HASH JOIN ANTI BUFFERED   4116K 443M 779K (0) 999:59:59  Q1,02  PCWP   
    5             BUFFER SORT            Q1,02  PCWC   
    6               PX RECEIVE    4116K 235M 36221 (0) 758:17:06  Q1,02  PCWP   
    7                 PX SEND HASH  :TQ10000  4116K 235M 36221 (0) 758:17:06    S->P  HASH 
    8                   TABLE ACCESS FULL  GL_POSTING_INTERIM_50123  4116K 235M 36221 (0) 758:17:06       
    9             PX RECEIVE    471M 23G 742K (0) 999:59:59  Q1,02  PCWP   
    10               PX SEND HASH  :TQ10001  471M 23G 742K (0) 999:59:59  Q1,01  P->P  HASH 
    11                 PX BLOCK ITERATOR    471M 23G 742K (0) 999:59:59  Q1,01  PCWC   
    12                   TABLE ACCESS FULL  GL_BALANCES  471M 23G 742K (0) 999:59:59  Q1,01  PCWP    WE are not using any parallel hint again all the tables in the insert query.
    Environment details.
    DB version - 11.2.0.1
    OS version - IBM AIX 6.1
    Please let me know why query is going for parallelism automatically as i am not using any parallel hint or any auto parallel.
    NAME                                 TYPE        VALUE
    fast_start_parallel_rollback         string      FALSE
    parallel_adaptive_multi_user         boolean     TRUE
    parallel_automatic_tuning            boolean     FALSE
    parallel_degree_limit                string      CPU
    parallel_degree_policy               string      MANUAL
    parallel_execution_message_size      integer     16384
    parallel_force_local                 boolean     FALSE
    parallel_instance_group              string
    parallel_io_cap_enabled              boolean     FALSE
    parallel_max_servers                 integer     8
    parallel_min_percent                 integer     0
    NAME                                 TYPE        VALUE
    parallel_min_servers                 integer     0
    parallel_min_time_threshold          string      AUTO
    parallel_server                      boolean     FALSE
    parallel_server_instances            integer     1
    parallel_servers_target              integer     64
    parallel_threads_per_cpu             integer     2
    recovery_parallelism                 integer     0Please suggest.
    Thanks

    That will depend on the query and whether it decides to use parallel or not. Having PARALLEL_AUTOMATIC_TUNING set to FALSE does not disable parallel query in your database. Unless you are talking about some other parameter when you say "parallel auto is manual"?
    Here is a worked example. Note my parallel settings at the end:
    create table rj_test (id number(10), name varchar2(20));
    exec dbms_stats.set_table_stats(ownname=>'SYS',tabname=>'RJ_TEST',numrows=>'1000000',numblks=>'10000');
    SQL> explain plan for
      2  select id, count(*)
      3  from rj_test
      4  group by id;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3757798270
    | Id  | Operation          | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |         |  1000K|    12M|  1058  (12)| 00:00:06 |
    |   1 |  HASH GROUP BY     |         |  1000K|    12M|  1058  (12)| 00:00:06 |
    |   2 |   TABLE ACCESS FULL| RJ_TEST |  1000K|    12M|   962   (3)| 00:00:05 |
    9 rows selected.
    SQL> select degree from user_tables where table_name = 'RJ_TEST';
    DEGREE
             1
    SQL> alter table rj_test parallel (degree 8);
    Table altered.
    SQL> explain plan for
      2  select id, count(*)
      3  from rj_test
      4  group by id;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    SQL> set lines 120
    SQL> set pages 1000
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2739002282
    | Id  | Operation                | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT         |          |  1000K|    12M|   145  (11)| 00:00:01 |        |      |            |
    |   1 |  PX COORDINATOR          |          |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)    | :TQ10001 |  1000K|    12M|   145  (11)| 00:00:01 |  Q1,01 | P->S | QC (RAND)  |
    |   3 |    HASH GROUP BY         |          |  1000K|    12M|   145  (11)| 00:00:01 |  Q1,01 | PCWP |            |
    |   4 |     PX RECEIVE           |          |  1000K|    12M|   145  (11)| 00:00:01 |  Q1,01 | PCWP |            |
    |   5 |      PX SEND HASH        | :TQ10000 |  1000K|    12M|   145  (11)| 00:00:01 |  Q1,00 | P->P | HASH       |
    |   6 |       HASH GROUP BY      |          |  1000K|    12M|   145  (11)| 00:00:01 |  Q1,00 | PCWP |            |
    |   7 |        PX BLOCK ITERATOR |          |  1000K|    12M|   133   (3)| 00:00:01 |  Q1,00 | PCWC |            |
    |   8 |         TABLE ACCESS FULL| RJ_TEST  |  1000K|    12M|   133   (3)| 00:00:01 |  Q1,00 | PCWP |            |
    15 rows selected.
    SQL> show parameter parallel
    NAME                                 TYPE        VALUE
    fast_start_parallel_rollback         string      LOW
    parallel_adaptive_multi_user         boolean     TRUE
    parallel_automatic_tuning            boolean     FALSE
    parallel_degree_limit                string      CPU
    parallel_degree_policy               string      MANUAL
    parallel_execution_message_size      integer     16384
    parallel_force_local                 boolean     FALSE
    parallel_instance_group              string
    parallel_io_cap_enabled              boolean     FALSE
    parallel_max_servers                 integer     16
    parallel_min_percent                 integer     0
    parallel_min_servers                 integer     1
    parallel_min_time_threshold          string      AUTO
    parallel_server                      boolean     FALSE
    parallel_server_instances            integer     1
    parallel_servers_target              integer     16
    parallel_threads_per_cpu             integer     2
    recovery_parallelism                 integer     0
    SQL>

  • Oracle 10g Insert query performs inconsistent as a query vs procedure and p

    Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    No error messages....
    I am facing a very weird issue that I have a insert statement in a procedure... pretty much
    inert
    into oracle_Table
    SELECT cr.a AS a,
    cr.b AS b,
    cr.c AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    @Pmo.World is a database link to a MSSQL...
    The problem I am having right now is, every time I run this insert as a query. Everything works as what it should be... However, when I put this insert into a procedure, it inserts nothing...
    Simple test Proceudre:
    declare
    -- Local variables here
    i integer;
    begin
    inert
    into oracle_Table
    SELECT cr.a AS a,
    cr.b AS b,
    cr.c AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    end;
    Thinking about character conversion issue I changed the procedure to
    inert
    into oracle_Table
    SELECT to_char(cr.a) AS a,
    to_char(cr.b) AS b,
    to_char(cr.c) AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    Then this Inser works in the procedure... however when I revert it back with the original version that doesnt have to_char... it is working still... then I kept it running for few days... since it runs once per day, it was working for the first 2 days and then stopped working the third day... I verified the source table and every time this procedure runs, source tables were not empty...
    It is so confusing because if I manually run the insert as a query, it worked every time I ran it... however if I put that into a procedure, it works from time to time..
    Any help is highly apprecaited
    Edited by: 986006 on Feb 4, 2013 8:51 AM

    986006 wrote:
    Thanks for the hints up... I have updated my post... As I post the test procedure...it is about the exact the same as the insert query... Every time, the insert would actually insert data into the table but every time I run the test procedure, nothing gets inserted in... It sounds unbelievable but it happens... ThanksYou obviously haven't read the FAQ, or at least you haven't bothered doing what it asks. Help us to help you.
    Can you recreate the problem with simpler data on your local machine? If so provide create table and insert statements for test data.
    Format your code and place between tags.
    At the very least post the *exact* SQL or PL/SQL you are trying to run: what you've posted isn't even valid SQL.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Append Hint in Oracle

    Hi All,
    Any thoughts on why we get redo generated during a Insert operation with /*+ APPEND */ hint when having the DB in archive log mode. And same statement generating very very less redo when the DB is in no archive log mode. Is the redo generation mandatory in ARCHIVE LOG MODE, if so how can we achieve a direct path insert in DB in archivelog mode.
    DB: 11.2.0
    OS: Windows XP.
    STMT:
    DB in Archive log Mode.
    SQL> insert /*+ append */ into test
    2 select object_id from x;
    71708 rows created.
    Statistics
    217 recursive calls
    146 db block gets
    228 consistent gets
    0 physical reads
    *907948 redo size*
    665 bytes sent via SQL*Net to client
    623 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    7 sorts (memory)
    0 sorts (disk)
    71708 rows processed
    DB in No-Archive Log Mode
    SQL> insert /*+ append */ into test
    2 select object_id from x;
    71708 rows created.
    Statistics
    33 recursive calls
    149 db block gets
    125 consistent gets
    0 physical reads
    *3152 redo size*
    662 bytes sent via SQL*Net to client
    623 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    71708 rows processed
    Any help would be greatly appreciated.
    Thanks in Advance.
    Edited by: user8710159 on Jul 11, 2011 12:40 PM

    from http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5280714813869
    It is even more deep then that. For example:
    Table Mode Insert Mode ArchiveLog mode result
    LOGGING APPEND ARCHIVE LOG redo generated
    NOLOGGING APPEND ARCHIVE LOG no redo
    LOGGING no append "" redo generated
    NOLOGGING no append "" redo generated
    LOGGING APPEND noarchive log mode no redo
    NOLOGGING APPEND noarchive log mode no redo
    LOGGING no append noarchive log mode redo generated
    NOLOGGING no append noarchive log mode redo generated
    Iordan Iotzov
    http://iiotzov.wordpress.com/

  • APPEND hints

    hi ,
    to my knowledge APPEND hints is to prevent writing to the log file ?
    so my following statement
    insert /*+ APPEND */ into tbl1 SELECT * from tbl2 will prevent the logging ?
    but it gave the following error : ORA-04030: out of process memory when trying to allocate 16504 bytes (pga heap,ksm stack)
    pls advise
    tks & rdgs

    NOLOGGING by Tom Kyte:
    the entire point of nologging is NOT TO GENERATE REDO for many operations --
    these objects are by definition "not recoverable" after these operations until
    you back them up.
    When you create a table or index in nologging -- the initial create is *not
    logged*. Hence, if you restore a backup from BEFORE the time of the create and
    you restore that backup -- all of the blocks that never had redo -- are missing!
    (not corrupt -- missing, purposely -- you told us to make them go away).
    when using a standby database for disaster recovery -- you cannot perform
    nologging operations without performing additional, manual work (in fact, in 9i,
    we can set a flag that says "ignore the request for nologging -- log it anyway"
    on the database to avoid this issue alltogether).

  • Append hint + Oracle Ole DB Provider

    Hi everybody!
    This is my first post here in this great forum! ;-)
    I have a problem using Append hint with Oracle OleDB Provider and I've been searching internet for an answer without any luck.
    I'm trying to use Append hint with ADO + Oracle OleDB Provider (OraOLEDB.Oracle.1), like in the SQL below:
    INSERT /*+APPEND*/
    INTO my_table(field1, field2, field3)
    SELECT 0 field1, v.field2, v.field3)
    FROM my_second_table v
    The problem: Oracle is still creting log for this INSERT (It is working like there was no Append hint).
    If I use the same SQL statement with Microsoft Ole DB Provider for Oracle, the Append hint works as expected (log is not created), but doesn't work at all with Oracle DB Provider.
    Trace shows me that the SQL sentence is ok (the append hint is there!).
    I've tried Oracle servers 9.2 and/or 10g, and the problem is the same.
    Question: Does Append hint work with Oracle OleDB Provider? If yes, why it is not working? Something related with connection properties?
    Any help will be much appreciated!
    Thanks in advance.
    Alexandre Machado

    Hi everybody!
    This is my first post here in this great forum! ;-)
    I have a problem using Append hint with Oracle OleDB Provider and I've been searching internet for an answer without any luck.
    I'm trying to use Append hint with ADO + Oracle OleDB Provider (OraOLEDB.Oracle.1), like in the SQL below:
    INSERT /*+APPEND*/
    INTO my_table(field1, field2, field3)
    SELECT 0 field1, v.field2, v.field3)
    FROM my_second_table v
    The problem: Oracle is still creting log for this INSERT (It is working like there was no Append hint).
    If I use the same SQL statement with Microsoft Ole DB Provider for Oracle, the Append hint works as expected (log is not created), but doesn't work at all with Oracle DB Provider.
    Trace shows me that the SQL sentence is ok (the append hint is there!).
    I've tried Oracle servers 9.2 and/or 10g, and the problem is the same.
    Question: Does Append hint work with Oracle OleDB Provider? If yes, why it is not working? Something related with connection properties?
    Any help will be much appreciated!
    Thanks in advance.
    Alexandre Machado

Maybe you are looking for