Tuning

Hi,
I have one table which has one million records.
while querying the table,the performance of the query is very slow. It takes arround 10 to 13 minutes to show the result.
Though Index has been created on it.
Can anyone one suggest how I Can tune the following query.
select * from <table name>
Also suggest me what are the possible ways for application tuning.
Thanx

Hi ,
Since your query takes too long in time... you should read:
When your query takes too long ...
Additionally....
your query does not specify any condition... So , i presume that it takes FTS(full table scan). You may consider to adjust the db parameter db_file_mutiblock_read_count....
Greetings....
Sim

Similar Messages

  • Help for query tuning

    hello all
    my one of query is returning result in 1-2 mins only for 1 lakh record but i am not sure if it showed me complete rows or not because when I an trying to get count of result ..its taking lot of time .when I am using this query on plsql code ..code is running slow so just wanted to confirm on query tuning point of view if its fine or not ..please look onto it and let me know if query is fine or not by explain plan .my oracle version is 11g
    this is my query
    SELECT ROWNUM , TRUNC(rownum/5000) + 20000 ,'FOR_UPDATE', sku_org.NAME ,
    acct_promo_sku.src_num , acct_promo_sku.sub_type ,
    promo_actual.sku_actual_pos
    FROM siebel.s_src acct_promo_hdr,
    siebel.s_src acct_title_format,
    siebel.s_src acct_promo_sku,
    siebel.s_src_x acct_promo_hdrx,
    siebel.s_src_x acct_promo_skux,
    siebel.s_prod_int prod,
    siebel.s_bu promo_hdr_org,
    siebel.s_bu sku_org,
    siebelwb.stg_sbl_acct_promo_actuals2 promo_actual
    WHERE acct_promo_hdr.sub_type = 'PLAN_ACCOUNT_PROMOTION'
    AND acct_promo_hdr.row_id = acct_title_format.par_src_id
    AND acct_title_format.sub_type = 'PLAN_ACCT_PROMOTION_CATEGORY'
    AND acct_title_format.row_id = acct_promo_sku.par_src_id
    AND acct_promo_sku.sub_type = 'PLAN_ACCOUNT_PROMOTION_PRODUCT'
    AND acct_promo_hdr.row_id = acct_promo_hdrx.par_row_id
    AND acct_promo_sku.row_id = acct_promo_skux.par_row_id(+)
    AND acct_promo_sku.prod_id = prod.row_id
    AND acct_promo_hdr.bu_id = promo_hdr_org.row_id
    AND acct_promo_sku.bu_id = sku_org.row_id
    AND prod.x_prod_material_num = promo_actual.material_number
    and prod.X_PROD_SALES_ORG=promo_actual.sales_org
    AND acct_promo_hdr.row_id = promo_actual.acct_promo_id
    and nvl(acct_promo_hdr.pr_accnt_id,0)=nvl(promo_actual.acct_siebel_rowid,0)
    and nvl(acct_promo_hdr.x_indirect_id,0)=nvl(promo_actual.indirect_acct_siebel_rowid,0)
    AND promo_actual.load_date >= TRUNC(SYSDATE)
    AND promo_actual.load_date < TRUNC(SYSDATE + 1)
    explain plan
    PLAN_TABLE_OUTPUT
    Plan hash value: 3864590768
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 298 | 2300 (1)| 00:00:28 |
    | 1 | COUNT | | | | | |
    |* 2 | FILTER | | | | | |
    | 3 | NESTED LOOPS | | | | | |
    | 4 | NESTED LOOPS | | 1 | 298 | 2300 (1)| 00:00:28 |
    | 5 | NESTED LOOPS OUTER | | 1 | 273 | 2298 (1)| 00:00:28 |
    | 6 | NESTED LOOPS | | 1 | 263 | 2296 (1)| 00:00:28 |
    | 7 | NESTED LOOPS | | 1 | 236 | 2295 (1)| 00:00:28 |
    | 8 | NESTED LOOPS | | 1 | 165 | 2292 (1)| 00:00:28 |
    | 9 | NESTED LOOPS | | 1 | 117 | 2289 (1)| 00:00:28 |
    | 10 | NESTED LOOPS | | 1 | 109 | 2289 (1)| 00:00:28 |
    | 11 | NESTED LOOPS | | 1 | 99 | 2287 (1)| 00:00:28 |
    |* 12 | TABLE ACCESS FULL | STG_SBL_ACCT_PROMO_ACTUALS2 | 1 | 49 | 2285 (1)| 00:0
    |* 13 | TABLE ACCESS BY INDEX ROWID| S_SRC | 1 | 50 | 2 (0)| 00:00:01 |
    |* 14 | INDEX UNIQUE SCAN | S_SRC_P1 | 1 | | 1 (0)| 00:00:01 |
    |* 15 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
    |* 16 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | 8 | 0 (0)| 00:00:01 |
    |* 17 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 48 | 3 (0)| 00:00:01 |
    |* 18 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
    |* 19 | TABLE ACCESS BY INDEX ROWID | S_SRC | 1 | 71 | 3 (0)| 00:00:01 |
    |* 20 | INDEX RANGE SCAN | S_SRC_F2 | 2 | | 2 (0)| 00:00:01 |
    | 21 | TABLE ACCESS BY INDEX ROWID | S_BU | 1 | 27 | 1 (0)| 00:00:01 |
    |* 22 | INDEX UNIQUE SCAN | S_BU_P1 | 1 | | 0 (0)| 00:00:01 |
    |* 23 | INDEX RANGE SCAN | S_SRC_X_U1 | 1 | 10 | 2 (0)| 00:00:01 |
    |* 24 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 |
    |* 25 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 25 | 2 (0)| 00:00:
    Predicate Information (identified by operation id):
    2 - filter(TRUNC(SYSDATE@!)<TRUNC(SYSDATE@!+1))
    12 - filter("PROMO_ACTUAL"."LOAD_DATE">=TRUNC(SYSDATE@!) AND "PROMO_ACTUAL"."LOAD_DATE"<TRUNC(SYSD
    13 - filter("ACCT_PROMO_HDR"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION' AND
    NVL("ACCT_PROMO_HDR"."PR_ACCNT_ID",'0')=NVL("PROMO_ACTUAL"."ACCT_SIEBEL_ROWID",'0') AND
    NVL("ACCT_PROMO_HDR"."X_INDIRECT_ID",'0')=NVL("PROMO_ACTUAL"."INDIRECT_ACCT_SIEBEL_ROWID",'0'
    14 - access("ACCT_PROMO_HDR"."ROW_ID"="PROMO_ACTUAL"."ACCT_PROMO_ID")
    15 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_PROMO_HDRX"."PAR_ROW_ID")
    16 - access("ACCT_PROMO_HDR"."BU_ID"="PROMO_HDR_ORG"."ROW_ID")
    17 - filter("ACCT_TITLE_FORMAT"."SUB_TYPE"='PLAN_ACCT_PROMOTION_CATEGORY')
    18 - access("ACCT_PROMO_HDR"."ROW_ID"="ACCT_TITLE_FORMAT"."PAR_SRC_ID")
    19 - filter("ACCT_PROMO_SKU"."PROD_ID" IS NOT NULL AND
    "ACCT_PROMO_SKU"."SUB_TYPE"='PLAN_ACCOUNT_PROMOTION_PRODUCT')
    20 - access("ACCT_TITLE_FORMAT"."ROW_ID"="ACCT_PROMO_SKU"."PAR_SRC_ID")
    22 - access("ACCT_PROMO_SKU"."BU_ID"="SKU_ORG"."ROW_ID")
    23 - access("ACCT_PROMO_SKU"."ROW_ID"="ACCT_PROMO_SKUX"."PAR_ROW_ID"(+))
    24 - access("ACCT_PROMO_SKU"."PROD_ID"="PROD"."ROW_ID")
    25 - filter("PROD"."X_PROD_MATERIAL_NUM" IS NOT NULL AND
    "PROD"."X_PROD_MATERIAL_NUM"="PROMO_ACTUAL"."MATERIAL_NUMBER" AND
    "PROD"."X_PROD_SALES_ORG"="PROMO_ACTUAL"."SALES_ORG")
    55 rows selected.
    thanks

    Hi,
    the plan you posted has the cost of 2300, i.e. 2300 single-block reads or equivalent number f multi-block reads. Even if none of the blocks is found in cache, 2300 reas shouldn't take more than a couple of minutes, beacause for most of the hard drives available today a disk read is typically within 5-10 ms.
    This means that if there is a problem, we will never find out about it by looking in the plan. And it's quite likely that there is, in fact, a problem, because the plan contains a bunch of nested joins, and the cost of each nested join is directly proportional to the cardinality of the previous nested loop. I.e. it suffices to make one bad mistake in estimating the number of rows coming fom one of the nested rows to screw up the entire plan and get all remaining estimates (including the total cost of the query) completely wrong.
    In order for us to be able to tell more, we need to see the plan with rowsource statistics, and please don't forget to use tags to preserve formatting (use the preview tab to make sure the posted plan is actually readable).
    Best regards,
      Nikolay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • HOW TO: Post a SQL statement tuning request - template posting

    This post is not a question, but similar to Rob van Wijk's "When your query takes too long ..." post should help to improve the quality of the requests for SQL statement tuning here on OTN.
    On the OTN forum very often tuning requests about single SQL statements are posted, but the information provided is rather limited, and therefore it's not that simple to provide a meaningful advice. Instead of writing the same requests for additional information over and over again I thought I put together a post that describes how a "useful" post for such a request should look like and what information it should cover.
    I've also prepared very detailed step-by-step instructions how to obtain that information on my blog, which can be used to easily gather the required information. It also covers again the details how to post the information properly here, in particular how to use the \ tag to preserve formatting and get a fixed font output:
    http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
    So again: This post here describes how a "useful" post should look like and what information it ideally covers. The blog post explains in detail how to obtain that information.
    In the future, rather than requesting the same additional information and explaining how to obtain it, I'll simply refer to this HOW TO post and the corresponding blog post which describes in detail how to get that information.
    *Very important:*
    Use the \ tag to enclose any output that should have its formatting preserved as shown below.
    So if you want to use fixed font formatting that preserves the spaces etc., do the following:
    \   This preserves formatting
    \And it will look like this:
       This preserves formatting
       . . .Your post should cover the following information:
    1. The SQL and a short description of its purpose
    2. The version of your database with 4-digits (e.g. 10.2.0.4)
    3. Optimizer related parameters
    4. The TIMING and AUTOTRACE output
    5. The EXPLAIN PLAN output
    6. The TKPROF output snippet that corresponds to your statement
    7. If you're on 10g or later, the DBMS_XPLAN.DISPLAY_CURSOR output
    The above mentioned blog post describes in detail how to obtain that information.
    Your post should have a meaningful subject, e.g. "SQL statement tuning request", and the message body should look similar to the following:
    *-- Start of template body --*
    The following SQL statement has been identified to perform poorly. It currently takes up to 10 seconds to execute, but it's supposed to take a second at most.
    This is the statement:
    select
    from
             t_demo
    where
             type = 'VIEW'
    order by
             id;It should return data from a table in a specific order.
    The version of the database is 11.1.0.7.
    These are the parameters relevant to the optimizer:
    SQL>
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.1.0.7
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL>
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     8
    SQL>
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL>
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2             sname
      3           , pname
      4           , pval1
      5           , pval2
      6  from
      7           sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          01-30-2009 16:25
    SYSSTATS_INFO        DSTOP                           01-30-2009 16:25
    SYSSTATS_INFO        FLAGS                         0
    SYSSTATS_MAIN        CPUSPEEDNW              494,397
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.Here is the output of EXPLAIN PLAN:
    SQL> explain plan for
      2  -- put your statement here
      3  select
      4             *
      5  from
      6             t_demo
      7  where
      8             type = 'VIEW'
      9  order by
    10             id;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |          |     1 |    60 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |     1 |    60 |     0   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    14 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL> select
      2             *
      3  from
      4             t_demo
      5  where
      6             type = 'VIEW'
      7  order by
      8             id;
    149938 rows selected.
    Elapsed: 00:00:02.21
    Execution Plan
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |          |     1 |    60 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |     1 |    60 |     0   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    Statistics
              0  recursive calls
              0  db block gets
         149101  consistent gets
            800  physical reads
            196  redo size
        1077830  bytes sent via SQL*Net to client
          16905  bytes received via SQL*Net from client
           1501  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
         149938  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing optionsThe TKPROF output for this statement looks like the following:
    TKPROF: Release 11.1.0.7.0 - Production on Mo Feb 23 10:23:08 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: orcl11_ora_3376_mytrace1.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    select
    from
             t_demo
    where
             type = 'VIEW'
    order by
             id
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch     1501      0.53       1.36        800     149101          0      149938
    total     1503      0.53       1.36        800     149101          0      149938
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 88 
    Rows     Row Source Operation
    149938  TABLE ACCESS BY INDEX ROWID T_DEMO (cr=149101 pr=800 pw=0 time=60042 us cost=0 size=60 card=1)
    149938   INDEX RANGE SCAN IDX_DEMO (cr=1881 pr=1 pw=0 time=0 us cost=0 size=0 card=1)(object id 74895)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                    1501        0.00          0.00
      db file sequential read                       800        0.05          0.80
      SQL*Net message from client                  1501        0.00          0.69
    ********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> -- put your statement here
    SQL> -- use the GATHER_PLAN_STATISTICS hint
    SQL> -- if you're not using STATISTICS_LEVEL = ALL
    SQL> select /*+ gather_plan_statistics */
      2  *
      3  from
      4  t_demo
      5  where
      6  type = 'VIEW'
      7  order by
      8  id;
    149938 rows selected.
    Elapsed: 00:00:02.21
    SQL>
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  d4k5acu783vu8, child number 0
    select   /*+ gather_plan_statistics */          * from          t_demo
    where          type = 'VIEW' order by          id
    Plan hash value: 1390505571
    | Id  | Operation                   | Name     | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT            |          |      1 |        |    149K|00:00:00.02 |     149K|   1183 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_DEMO   |      1 |      1 |    149K|00:00:00.02 |     149K|   1183 |
    |*  2 |   INDEX RANGE SCAN          | IDX_DEMO |      1 |      1 |    149K|00:00:00.02 |    1880 |    383 |
    Predicate Information (identified by operation id):
       2 - access("TYPE"='VIEW')
    20 rows selected.I'm looking forward for suggestions how to improve the performance of this statement.
    *-- End of template body --*
    I'm sure that if you follow these instructions and obtain the information described, post them using a proper formatting (don't forget about the \ tag) you'll receive meaningful advice very soon.
    So, just to make sure you didn't miss this point:Use proper formatting!
    If you think I missed something important in this sample post let me know so that I can improve it.
    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/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Alex Nuijten wrote:
    ...you missed the proper formatting of the Autotrace section ;-)Alex,
    can't reproduce, does it still look unformatted? Or are you simply kidding? :-)
    Randolf
    PS: Just noticed that it actually sometimes doesn't show the proper formatting although the code tags are there. Changing to the \ tag helped in this case, but it seems to be odd.
    Edited by: Randolf Geist on Feb 23, 2009 11:28 AM
    Odd behaviour of forum software                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help in tuning a procedure

    DECLARE
    CURSOR Cur_sub_rp IS
    SELECT A.SUB_ACCOUNT, B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
    FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
    WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
    AND A.MONTH_ID = B.MONTH_ID ;
    TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
    values_tab t_values_tab := t_values_tab() ;
    BEGIN
    OPEN Cur_sub_rp ;
    LOOP
    FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
    LIMIT 1000;
    EXIT WHEN Cur_sub_rp%NOTFOUND ;
    END LOOP ;
    CLOSE Cur_sub_rp;
    FORALL i IN VALUES_TAB.first..values_tab.last
    INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
    commit;
    END;
    The tables used here has 9 million records each.
    The total process takes around 19 minutes.
    Need your help in optimizing the process.

    i have tried using
    Create table as SELECT A.SUB_ACCOUNT,  B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
                        FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
                        WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
                        AND A.MONTH_ID = B.MONTH_ID (+);But still taking long time(apprx 15 min).
    so used this...
    help me in tuning the query in either of this.
    DECLARE
    CURSOR Cur_sub_rp IS
                    SELECT A.SUB_ACCOUNT,  B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
                        FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
                        WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
                        AND A.MONTH_ID = B.MONTH_ID (+);
    TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
    values_tab t_values_tab := t_values_tab()  ;
    BEGIN
        OPEN Cur_sub_rp ;
        LOOP
            FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
                                                LIMIT 1000;
            EXIT WHEN Cur_sub_rp%NOTFOUND ;
        END LOOP ;
        CLOSE Cur_sub_rp;
    FORALL i IN VALUES_TAB.first..values_tab.last
    INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
    commit;
    END;Message was edited by:
    Vakeel
    Message was edited by:
    Vakeel

  • Real Instruments, Enhance Tuning, Enhance Timing, Etc?

    Hi,
    I am having trouble getting to the Real Instruments, Enhance Tuning, Enhance Timing, area of GB3.
    I see the window partially, but not enough to move the sliders, while seeing there placement..
    I'm sure there's something I'm unaware of to get the full view, and I've snapped a screen shot to show what I'm talking about, if anyone is interested..
    Thanks For Any Help,
    Eric

    Hang-
    I have a work around I kind of stumbled onto..
    http://members.aol.com/unkie/GB3-pict-2.gif
    After you select the Real Instrument track you'd like to correct the pitch or timing of, you hit the "I" for track information, then you can click on the region arrow,(?) and the Enhancing area opens up properly.
    Check out the picture linked above, and below I will place the before shot link..
    The preference not coming up seems to be linked to using iChat, believe it or not..
    I read it here in the forum.
    If you open iChat, and then Garageband 3, your preference pane may not open up, until you reboot your computer.
    Strange but true..
    HangTime, Thanks for "Hanging" in there with me through this dilemma..
    Take Care,
    Eric
    Before Link: http://members.aol.com/unkie/GB3.gif
    G4 Desktop (QuickSilver) Dual 1 Gig Processors Mac OS X (10.4.3) 1.5 Gigs of RAM

  • Help me in Report(RDF) Performance tuning

    Hi Viewers,
    I need some steps related to report ( RDF) perfomance tune.
    here is my following question.
    (Q). A report for 100,000+ lines/records is taking 20 hours to run – what steps should be taken to resolve / tune
    Thanks in advance.
    new

    Hello,
    Have you followed the "tips" in the documents ?
    Oracle® Application Server Reports Services Publishing Reports to the Web
    10g Release 2 (10.1.2)
    B14048-02
    20 Tuning Oracle Reports
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_tune.htm
    Regards

  • Report running for long time & performance tuning

    Hi All,
    (1). WebI report is running for long time.so what are the steps i need to check for it ?
    (2). Can you tell me about performance tuning in BO ?
    please help me.....
    Thanks
    Kumar

    (1). WebI report is running for long time.so what are the steps i need to check for it ?
    The first step is to see if the problem lies in the query on the data source or in webi itself. Depending on the data source there are different ways to extract the query and try to run it against the database. Which source does your report uses?
    (2). Can you tell me about performance tuning in BO ?
    I would recommend to start by reading the administrator's guide. There is a section about how to improve performance.
    Regards,
    Stratos

  • Need Help in Breaking a big view into multiple small views or tuning the vw

    Hi
    I have the following view can some one help me in breaking the view in small views or any recommendations for tuning it.
    CODE
    CREATE OR REPLACE FORCE VIEW "CRUVPD"."PX16_CHK_VW_SUMMARY_VW" ("CIDN", "BATCH_NUMBER", "BUSINESS_UNIT", "CHECK_VOUCHER_NUMBER", "CHECK_VOUCHER_CODE", "CHECKVIEW_CLOCK_NUMBER", "COMPANY_CHECKVIEW_HOME_DEPT", "PERIOD_END_DATE", "FEDERAL_TAX", "GROSS_PAY"
    , "HOME_DEPARTMENT", "HOME_DEPARTMENT_DESC", "LIVED_LOCAL_TAX_CODE", "LIVED_STATE_TAX_CODE", "LIVED_LOCAL_TAX", "LIVED_STATE_TAX", "MEDICARE_TAX", "NET_PAY", "DEPARTMENT_WORKED_IN", "PAY_TO_COMPANY_INDICATOR", "PAY_DATE", "PAYROLL_NUMBER", "SCHOOL_DISTRIC
    T_TAX", "CHECKVIEW_SCHOOL_DISTRICT", "SOCIAL_SECURITY_TAX", "SUI_SDI_TAX", "SUI_SDI_TAX_CODE", "VOID_CHECK_INDICATOR", "WEEK_NUMBER", "WORKED_LOCAL_TAX_CODE", "WORKED_STATE_TAX_CODE", "WORKED_LOCAL_TAX", "WORKED_STATE_TAX", "YEAR", "COMPANY_CODE", "FILE_N
    UMBER", "FIRST_NAME", "LAST_NAME", "LAST_NAME_FIRST_NAME", "SOCIAL_SECURITY_NUMBER", "STATUS", "OVERTIME_EARNINGS", "OVERTIME_HOURS", "REGULAR_EARNINGS", "REGULAR_HOURS", "VIEWPK", "HOME_COST_NUMBER", "TAX_FREQUENCY", "COMPANY_COST_NUMBER", "COST_NUMBER_W
    ORKED_IN", "DISTRIBUTION_NUMBER", "TOTAL_DEDUCTIONS_AMOUNT", "TOTAL_HOURS_AMOUNT", "TOTAL_MEMO_AMOUNT", "TOTAL_OTHER_EARNINGS", "TOTAL_OTHER_HOURS", "CHECK_SEQ_NO", "JOINKEY", "CHECK_REVERSAL_INDICATOR") AS
    with user_security_homedept
    AS
    (select /*+ INLINE */ distinct cg.cidn,co_code,asso.oid,asso.name,department_Access ,t2.column_value dep,cg.oid
    from px16_cocodegroup cg ,
    px16_associate asso ,
    px16_securityobject so,
    px16_cocodegrp_securitygrp cs,
    px16_security_group sg ,
    TABLE(f_str2tbl_px16(cg.department_access)) t2
    where cg.USEROID = asso.OID
    and cg.co_code = substr(so.name,8,3)
    and upper(asso.name) = upper(sys_context('payx_r16_app_context', 'app_userid'))
    and cg.oid = cs.cocodegroupoid
    and cs.securitygroupoid = sg.oid
    and cg.cidn = asso.cidn
    and cg.cidn = so.cidn
    and cg.cidn = cs.cidn
    and cs.cidn = sg.cidn
    order by 2,1
    user_security_cost_no
    AS
    (select /*+ INLINE */
    cg.cidn,co_code,count(distinct cd.code)cost_no,cd.code
    from px16_cocodegroup cg ,
    px16_associate asso ,
    px16_securityobject so,
    px16_cocodegrp_securitygrp cs,
    px16_security_group sg ,
    px16_customaccessdetail cd
    where cg.USEROID = asso.OID
    and cg.co_code = substr(so.name,8,3)
    and upper(asso.name) = upper(sys_context('payx_r16_app_context', 'app_userid'))
    and cg.oid = cs.cocodegroupoid
    and cs.securitygroupoid = sg.oid
    and cg.oid = cd.cocodegroupoid(+)
    and cg.cidn = cd.cidn(+)
    and cg.cidn = asso.cidn
    and cg.cidn = so.cidn
    and cg.cidn = cs.cidn
    and cs.cidn = sg.cidn
    group by cg.cidn,co_code,cd.code
    order by 2,1
    super_user_check as
    (SELECT
    distinct a.cidn su_cidn,1 as su_user
    FROM
    px16_LINK LN
    , px16_userprofile up
    , px16_ASSOCIATE a
    , px16_pcp_user pu
    WHERE
    a.oid = pu.oid
    AND pu.userprofileoid = up.oid
    AND LN.parentoid = up.oid
    AND a.active = 1
    AND a.cidn=pu.cidn
    AND pu.cidn=up.cidn
    AND ln.cidn=up.cidn
    AND upper(a.name) = upper(sys_context('payx_r16_app_context', 'app_userid'))
    AND upper(up.name) = upper('Super user')
    nonsuper_user_check as
    SELECT distinct a.cidn s_cidn , 1 as non_user
    FROM
    px16_LINK LN
    , px16_userprofile up
    , px16_ASSOCIATE a
    , px16_pcp_user pu
    WHERE
    a.oid = pu.oid
    AND pu.userprofileoid = up.oid
    AND LN.parentoid = up.oid
    AND a.active = 1
    AND a.cidn=pu.cidn
    AND pu.cidn=up.cidn
    AND ln.cidn=up.cidn
    AND upper(a.name) = upper(sys_context('payx_r16_app_context', 'app_userid'))
    AND LN.childoid IN ( 'SYS:5:7478')
    SELECT distinct
    cidn
    ,batch_number Batch_Number
    , business_unit Business_Unit
    , check_voucher_number Check_Voucher_Number
    , check_voucher_code Check_Voucher_Code
    , clock_number CheckView_Clock_Number
    , company_code_or_dept Company_CheckView_Home_Dept
    , period_end_date Period_End_Date
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, 1, (INSTR(taxes_and_rates, '~', 1, 1) -1)), CHR(155), NULL)) Federal_Tax
    , gross_pay Gross_Pay
    , home_department Home_Department
    , home_department_descr Home_Department_Desc
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 1) +1)
    , INSTR(taxes_and_rates, '~', 1, 2) - (INSTR(taxes_and_rates, '~', 1, 1) +1)), CHR(155), NULL), 1, 32) Lived_Local_Tax_Code
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 2) +1)
    , INSTR(taxes_and_rates, '~', 1, 3) - (INSTR(taxes_and_rates, '~', 1, 2) +1)), CHR(155), NULL), 1, 32) Lived_State_Tax_Code
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 3) +1)
    , INSTR(taxes_and_rates, '~', 1, 4) - (INSTR(taxes_and_rates, '~', 1, 3) +1)), CHR(155), NULL)) Lived_Local_Tax
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 4) +1)
    , INSTR(taxes_and_rates, '~', 1, 5) - (INSTR(taxes_and_rates, '~', 1, 4) +1)), CHR(155), NULL)) Lived_State_Tax
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 5) +1)
    , INSTR(taxes_and_rates, '~', 1, 6) - (INSTR(taxes_and_rates, '~', 1, 5) +1)), CHR(155), NULL)) Medicare_Tax
    , net_pay Net_Pay
    , department_paid Department_Worked_In
    , to_pay_indicator Pay_to_Company_Indicator
    , pay_date Pay_Date
    , payroll_number Payroll_Number
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 6) +1)
    , INSTR(taxes_and_rates, '~', 1, 7) - (INSTR(taxes_and_rates, '~', 1, 6) +1)), CHR(155), NULL)) School_District_Tax
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 7) +1)
    , INSTR(taxes_and_rates, '~', 1, 8) - (INSTR(taxes_and_rates, '~', 1, 7) +1)), CHR(155), NULL), 1, 32) CheckView_School_District
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 8) +1)
    , INSTR(taxes_and_rates, '~', 1, 9) - (INSTR(taxes_and_rates, '~', 1, 8) +1)), CHR(155), NULL)) Social_Security_Tax
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 9) +1)
    , INSTR(taxes_and_rates, '~', 1, 10) - (INSTR(taxes_and_rates, '~', 1, 9) +1)), CHR(155), NULL)) SUI_SDI_Tax
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 10) +1)
    , INSTR(taxes_and_rates, '~', 1, 11) - (INSTR(taxes_and_rates, '~', 1, 10) +1)), CHR(155), NULL), 1, 32) SUI_SDI_Tax_Code
    , void_check_indicator Void_Check_Indicator
    , week_number Week_Number
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 11) +1)
    , INSTR(taxes_and_rates, '~', 1, 12) - (INSTR(taxes_and_rates, '~', 1, 11) +1)), CHR(155), NULL), 1, 32) Worked_Local_Tax_Code
    , SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 12) +1)
    , INSTR(taxes_and_rates, '~', 1, 13) - (INSTR(taxes_and_rates, '~', 1, 12) +1)), CHR(155), NULL), 1, 32) Worked_State_Tax_Code
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 13) +1)
    , INSTR(taxes_and_rates, '~', 1, 14) - (INSTR(taxes_and_rates, '~', 1, 13) +1)), CHR(155), NULL)) Worked_Local_Tax
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 14) +1)
    , INSTR(taxes_and_rates, '~', 1, 15) - (INSTR(taxes_and_rates, '~', 1, 14) +1)), CHR(155), NULL)) Worked_State_Tax
    , year Year
    , company_code Company_Code
    , file_number File_Number
    , first_name First_Name
    , last_name Last_Name
    , name Last_Name_First_Name
    , ssn Social_Security_Number
    , status Status
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 15) +1)
    , INSTR(taxes_and_rates, '~', 1, 16) - (INSTR(taxes_and_rates, '~', 1, 15) +1)), CHR(155), NULL)) Overtime_Earnings
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 16) +1)
    , INSTR(taxes_and_rates, '~', 1, 17) - (INSTR(taxes_and_rates, '~', 1, 16) +1)), CHR(155), NULL)) Overtime_Hours
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 17) +1)
    , INSTR(taxes_and_rates, '~', 1, 18) - (INSTR(taxes_and_rates, '~', 1, 17) +1)), CHR(155), NULL)) Regular_Earnings
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 18) +1)
    , INSTR(taxes_and_rates, '~', 1, 19) - (INSTR(taxes_and_rates, '~', 1, 18) +1)), CHR(155), NULL)) Regular_Hours
    , (company_code || '/' || ssn || '/' || file_number || '/' || TO_CHAR(payroll_number) || '/'
    || TO_CHAR(year) || '/' || TO_CHAR(week_number) || '/' || check_voucher_number
    || '/' || to_char(check_seq_num) || '/' || TO_CHAR(distribution_number)) Viewpk
    , home_costnumber_desc Home_Cost_Number
    , tax_frequency Tax_Frequency
    , co_chkv_home_cost_no Company_Cost_Number
    , cost_no_worked_in Cost_Number_Worked_In
    , distribution_number Distribution_Number
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 19) +1)
    , INSTR(taxes_and_rates, '~', 1, 20) - (INSTR(taxes_and_rates, '~', 1, 19) +1)), CHR(155), NULL)) Total_Deductions_Amount
    , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 20) +1)
    , INSTR(taxes_and_rates, '~', 1, 21) - (INSTR(taxes_and_rates, '~', 1, 20) +1)), CHR(155), NULL)), 0) Total_Hours_Amount
    , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 21) +1)
    , INSTR(taxes_and_rates, '~', 1, 22) - (INSTR(taxes_and_rates, '~', 1, 21) +1)), CHR(155), NULL)), 0) Total_Memo_Amount
    , NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 22) +1)
    , INSTR(taxes_and_rates, '~', 1, 23) - (INSTR(taxes_and_rates, '~', 1, 22) +1)), CHR(155), NULL)), 0) Total_Other_Earnings
    , TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 23) +1)), CHR(155), NULL)) Total_Other_Hours
    , check_seq_num Check_Seq_No
    , (NVL(company_code, '~') || CHR(155) || NVL(file_number, '~') || CHR(155) || NVL(ssn, '~') || CHR(155) || NVL(TO_CHAR(year), '~') || CHR(155)
    || NVL(TO_CHAR(week_number), '~') || CHR(155) || NVL(TO_CHAR(payroll_number), '~')
    || CHR(155) || NVL(check_voucher_number, '~') || CHR(155) || NVL(TO_CHAR(check_seq_num), '~') || CHR(155) || NVL(TO_CHAR(distribution_number), '~')) Joinkey
    , chk_reverse Check_Reversal_Indicator
    FROM
    SELECT
    ch.cidn cidn
    /*BATCH NUMBER*/
    , ch.batch_nb batch_number
    , /*BUSINESS UNIT*/
    (select asso.description
    from px16_appointment ap,
    px16_jobposition jp,
    px16_corporation co,
    px16_associate asso,
    px16_payrollagreement pa,
    px16_payrollgroup pg
    where
    ch.cidn = pg.cidn
    AND ch.cidn = pa.cidn
    AND pa.cidn = pg.cidn
    AND pa.cidn = ap.cidn
    AND em.cidn = ap.cidn
    AND ap.cidn = jp.cidn
    and jp.cidn = co.cidn
    and co.cidn = asso.cidn
    and ch.co_code=pg.co_code
    and ch.file_nb=pa.file_number
    and pa.cocodeoid=pg.oid
    and pa.appointmentoid=ap.oid
    and em.oid=ap.employmentoid
    and ap.jobpositionoid=jp.oid
    and jp.corporationoid=co.oid
    and co.oid=asso.oid) business_unit
    , /*CHECK/VOUCHER NUMBER*/
    ch.check_nb check_voucher_number
    , /*CHECK/VOUCHER CODE*/
    SUBSTR(f_type_px16(ch.cidn,ch.chkvchcodeoid, 'NAME'), 1, 255) check_voucher_code
    , /*CLOCK NUMBER*/
    ch.clock_id clock_number
    , /* COMPANY CODE OR DEPT*/
    ch.co_code||'/'||substr(ch.home_dept_code,1,20) company_code_or_dept
    , /*PERIOD END DATE*/
    ch.payroll_ending_date period_end_date
    , /*GROSS PAY*/
    NVL(chd.gross_pay_amt,0) gross_pay
    , /*HOME DEPARTMENT*/
    ch.home_dept_code home_department
    , /*HOME DEPARTMENT DESCRIPTION*/
    (select ty.description
    from px16_type ty,px16_securityobject sc
    where
    ch.cidn = sc.cidn
    and ty.cidn in ('COMMON', ch.cidn)
    and ch.home_dept_code=ty.name
    and ty.category='T_CO_DEPT'
    and ty.securityoid=sc.oid
    and ch.co_code=substr(sc.name,8)) home_department_descr
    , /*NET PAY*/
    nvl(chd.net_pay_amt,0) net_pay
    , /*DEPARTMENT PAID*/
    -- ch.paid_in_debt_code department_paid
    chd.worked_in_dept department_paid
    , /*TO PAY INDICATOR*/
    decode(to_char(ch.pay_to_co),'1','Y','0','N',to_char(ch.pay_to_co)) to_pay_indicator
    , /*PAY DATE*/
    ch.pay_date pay_date
    , /*PAYROLL NUMBER*/
    to_char(ch.payroll_nb) payroll_number
    , /*VOID CHECK INDICATOR*/
    decode(to_char(ch.void_flag),'1','Y','0','N',to_char(ch.void_flag)) void_check_indicator
    , /*WEEK NUMBER*/
    TO_number(ch.week) week_number
    , /*YEAR*/
    to_char(ch.year) year
    , /*COMPANY CODE*/
    ch.co_code company_code
    , /*FILE NUMBER*/
    LPAD(ch.file_nb,6,0) file_number
    , /*FIRST NAME*/
    pe.first_name first_name
    , /*LAST NAME*/
    pe.last_name last_name
    , /*NAME*/
    pe.last_name||', '||pe.first_name name
    , /*SSN*/
    payx_r16_principal_info.masked_ssn(pe.unique_id, ch.cidn) ssn
    , /*STATUS*/
    (SELECT SUBSTR(f_type_px16(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
    from
    px16_appointment ap,
    /*context co_ap,*/
    px16_payrollagreement pa,
    px16_payrollgroup pg
    where
    pg.cidn=ch.cidn
    and pa.cidn=ch.cidn
    and ap.cidn=pa.cidn
    and ap.cidn = em.cidn
    and ap.employmentoid=em.oid
    and ap.active=1
    and ap.oid=pa.appointmentoid
    and lpad(to_char(pa.file_number),6,0)=ch.file_nb
    and pa.cocodeoid=pg.oid
    and pg.co_code=ch.co_code) status
    -- FED TAX
    -- , LIVED LOCAL TAX CODE, LIVED STATE TAX CODE, LIVED LOCAL TAX, LIVED STATE TAX, MEDICARE TAX
    -- , SCHOOL DISTRICT TAX, SCHOOL DISTRICT, SOCIAL SECURITY TAX, SUI SDI TAX, SUI SDI TAX CODE
    -- , WORKED LOCAL TAX CODE, WORKED STATE TAX CODE, WORKED LOCAL TAX, WORKED STATE TAX
    -- , OVERTIME EARNINGS, OVERTIME HOURS, REGULAR EARNINGS, REGULAR HOURS
    NVL (
    (SELECT
    TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2982', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', ci.code, NULL), NULL)), CHR(155)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', DECODE(ci.code,'XX',null,ci.code), NULL), NULL)), CHR(155)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4118', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', ci.code, NULL), NULL)), CHR(155)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2988', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', ci.code, NULL), NULL)), CHR(155)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', ci.code, NULL), NULL)), CHR(155)) || '~'
    || NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', ci.code, NULL), NULL)), CHR(155)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3713', NVL(ci.amount,0), 0)), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3727', NVL(ci.amount,0), 0)), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3715', NVL(ci.amount,0), 0)), 0)) || '~'
    || TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3716', NVL(ci.amount,0), 0)), 0)) || '~'
    -- R16 columns.
    -- Total Deductions Amount === Other Deductions on UI screen.
    || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'DeductionHistory'
    , DECODE(NVL(ci.statutory_ded, 0), 0
    , DECODE(ci.taxcodeoid, NULL
    , DECODE(ci.code, NULL, 0, NVL(ci.amount,0)), 0), 0), 0)), 0)) || '~' -- "Total Deductions Amount"
    || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'OvertimeHours', NVL(ci.amount,0)
    , 'AdditionalHours', NVL(ci.amount,0), 'RegularHours', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Hours Amount"
    || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'Memo', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Memo Amount"
    || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalEarnings', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Other Earnings"
    || TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalHours', NVL(ci.amount,0), 0)), 0)) -- "Total Other Hours"
    FROM
    px16_checkhistoryitem ci
    , px16_sys_type chcat
    WHERE
    ci.cidn=chd.cidn
    AND ci.checkhistorydistributionoid = chd.oid
    AND chcat.category = 'CheckHistoryItem'
    AND chcat.oid = ci.histtypeoid
    -- AND ci.histtypeoid IN ('SYS:4:3713', 'SYS:4:3727', 'SYS:4:3715', 'SYS:4:3716', 'SYS:4:3709')
    ), '0' || '~' || CHR(155) || '~' || CHR(155)
    || '0~0~0~0~' || CHR(155) || '~0~0~' || CHR(155) || '~' || CHR(155) || '~'
    || CHR(155) || '~0~0~0~0~0~0'
    ) taxes_and_rates
    , ch.check_seq_num check_seq_num
    , ch.home_cost_number home_costnumber_desc
    , SUBSTR(f_type_px16(ch.cidn,ch.payfrequencyoid, 'NAME'), 1, 255) tax_frequency
    , (ch.co_code || '/' || ch.home_cost_number) co_chkv_home_cost_no
    , chd.worked_in_cost_number cost_no_worked_in
    , chd.distribution_number distribution_number
    , DECODE(NVL(ch.reversed_flag, 0), 1, 'Y', 'N') chk_reverse
    FROM
    px16_checkhistory ch
    , px16_employment em
    , px16_person pe
    , px16_payrollgroup pg
    , px16_checkhistory_dist chd
    , px16_appointment ap
    WHERE
    ch.cidn = em.cidn
    and em.cidn = pe.cidn
    and pg.cidn = ch.cidn
    and ch.cidn = chd.cidn
    and ap.cidn(+) = em.cidn
    and ch.employmentoid=em.oid
    AND em.personoid=pe.oid
    AND pg.co_code = ch.co_code
    AND ch.active = 1
    AND ch.oid = chd.checkhistoryoid
    AND ap.employmentoid(+) = em.oid
    AND DECODE(ap.oid, NULL, 1, NVL((SELECT 1 FROM px16_payrollagreement pa
    WHERE
    pa.cidn = ap.cidn
    and pa.cidn = ch.cidn
    and pa.cidn = pg.cidn
    and pa.appointmentoid = ap.oid
    AND pa.file_number = ch.file_nb
    AND pa.cocodeoid = pg.oid), 0)) = 1
    and ch.cidn in (select distinct s_cidn from nonsuper_user_check)
    AND ( sys_context('payx_r16_app_context', 'app_role') in ('ADP', 'CSR')
    or (exists (select 1 from super_user_check where su_cidn =ch.cidn))
    or (ch.cidn,ch.co_code,ch.home_dept_code) in (select cidn,co_code,dep from user_security_homedept)
    or (ch.cidn,ch.co_code,ch.home_cost_number) in (select cidn,co_code,code from user_security_cost_no)
    or ( exists(select co_code from user_security_homedept where cidn=ch.cidn and co_code = ch.co_code and dep is null)
    and exists(select co_code from user_security_cost_no where cidn=ch.cidn and co_code = ch.co_code and cost_no = 0) )
    Explain plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 1 | 7519 | 99 (2)|
    | 1 | VIEW | PX16_CHK_VW_SUMMARY_VW | 1 | 7519 | |
    | 2 | SORT UNIQUE | | 1 | 445 | 78 (0)|
    |* 3 | FILTER | | | | |
    | 4 | NESTED LOOPS OUTER | | 1 | 445 | 63 (2)|
    | 5 | NESTED LOOPS | | 1 | 414 | 58 (2)|
    | 6 | NESTED LOOPS | | 1 | 362 | 53 (2)|
    | 7 | NESTED LOOPS | | 1 | 331 | 48 (3)|
    | 8 | NESTED LOOPS | | 1 | 306 | 43 (3)|
    | 9 | NESTED LOOPS | | 1 | 253 | 38 (3)|
    | 10 | NESTED LOOPS | | 1 | 120 | 23 (5)|
    | 11 | NESTED LOOPS | | 1 | 79 | 18 (6)|
    | 12 | NESTED LOOPS | | 1 | 53 | 13 (8)|
    |* 13 | INDEX FAST FULL SCAN | USERPROFILE_GG_U | 5 | 110 | 11 (0)|
    |* 14 | INDEX RANGE SCAN | UQ_LINK | 1 | 31 | |
    | 15 | TABLE ACCESS BY INDEX ROWID | PCP_USER | 1 | 26 | 6 (17)|
    |* 16 | INDEX RANGE SCAN | XIF3PCP_USER | 1 | | |
    |* 17 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 41 | 6 (17)|
    |* 18 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |* 19 | TABLE ACCESS BY INDEX ROWID | CHECKHISTORY | 1 | 133 | 16 (7)|
    |* 20 | INDEX RANGE SCAN | J_CO_CODE | 13 | | 2 (0)|
    | 21 | TABLE ACCESS BY INDEX ROWID | CHECKHISTORYDISTRIBUTION | 1 | 53 | 6 (17)|
    |* 22 | INDEX RANGE SCAN | TMP_IDX11 | 1 | | |
    | 23 | TABLE ACCESS BY INDEX ROWID | PAYROLLGROUP | 1 | 25 | 6 (17)|
    |* 24 | INDEX RANGE SCAN | PAYROLLGROUP_IDX2 | 1 | | |
    | 25 | TABLE ACCESS BY INDEX ROWID | EMPLOYMENT | 1 | 31 | 6 (17)|
    |* 26 | INDEX UNIQUE SCAN | EMPLOYMENT_GG_U | 1 | | |
    | 27 | TABLE ACCESS BY INDEX ROWID | PERSON | 1 | 52 | 6 (17)|
    |* 28 | INDEX UNIQUE SCAN | PERSON_GG_U | 1 | | |
    | 29 | TABLE ACCESS BY INDEX ROWID | APPOINTMENT | 1 | 31 | 6 (17)|
    |* 30 | INDEX RANGE SCAN | XIF12APPOINTMENT | 1 | | |
    |* 31 | FILTER | | | | |
    |* 32 | TABLE ACCESS BY INDEX ROWID | PAYROLLAGREEMENT | 1 | 34 | 21 (5)|
    |* 33 | INDEX RANGE SCAN | UQ_FILE_NO_COCODE | 1 | | 3 (0)|
    |* 34 | FILTER | | | | |
    | 35 | NESTED LOOPS | | 1 | 130 | 27 (4)|
    | 36 | NESTED LOOPS | | 1 | 89 | 22 (5)|
    | 37 | NESTED LOOPS | | 1 | 63 | 17 (6)|
    |* 38 | TABLE ACCESS BY INDEX ROWID | USERPROFILE | 1 | 41 | 16 (7)|
    |* 39 | INDEX RANGE SCAN | XIF1USERPROFILE | 1 | | 2 (0)|
    |* 40 | INDEX RANGE SCAN | LINK_IDX2 | 1 | 22 | |
    | 41 | TABLE ACCESS BY INDEX ROWID | PCP_USER | 1 | 26 | 6 (17)|
    |* 42 | INDEX RANGE SCAN | XIF3PCP_USER | 1 | | |
    |* 43 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 41 | 6 (17)|
    |* 44 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |* 45 | FILTER | | | | |
    | 46 | NESTED LOOPS | | 1 | 144 | 48 (3)|
    | 47 | MERGE JOIN CARTESIAN | | 1 | 142 | 37 (3)|
    | 48 | NESTED LOOPS | | 1 | 116 | 32 (4)|
    | 49 | NESTED LOOPS | | 1 | 96 | 31 (4)|
    | 50 | NESTED LOOPS | | 1 | 72 | 26 (4)|
    |* 51 | TABLE ACCESS BY INDEX ROWID | COCODEGROUP | 1 | 34 | 21 (5)|
    |* 52 | INDEX RANGE SCAN | XIF1COCODEGROUP | 9 | | 2 (0)|
    |* 53 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 38 | 6 (17)|
    |* 54 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |* 55 | INDEX RANGE SCAN | COSEC_IDX_GG | 1 | 24 | 1 (0)|
    |* 56 | INDEX UNIQUE SCAN | SECURITY_GROUP_GG_U | 1 | 20 | |
    | 57 | BUFFER SORT | | 1 | 26 | 35 (0)|
    |* 58 | INDEX RANGE SCAN | UQ_SECURITYOBJECT | 1 | 26 | 1 (0)|
    |* 59 | COLLECTION ITERATOR PICKLER FETCH | F_STR2TBL_PX16 | | | |
    |* 60 | FILTER | | | | |
    | 61 | SORT GROUP BY | | 1 | 183 | 66 (0)|
    | 62 | NESTED LOOPS | | 1 | 183 | 51 (2)|
    | 63 | NESTED LOOPS | | 1 | 163 | 50 (2)|
    |* 64 | HASH JOIN OUTER | | 1 | 139 | 45 (3)|
    | 65 | NESTED LOOPS | | 1 | 96 | 42 (3)|
    |* 66 | HASH JOIN | | 1 | 58 | 37 (3)|
    | 67 | TABLE ACCESS BY INDEX ROWID | SECURITYOBJECT | 13 | 338 | 16 (7)|
    |* 68 | INDEX RANGE SCAN | SECURITYOBJECT_IDX1 | 13 | | 2 (0)|
    | 69 | TABLE ACCESS BY INDEX ROWID | COCODEGROUP | 9 | 288 | 21 (5)|
    |* 70 | INDEX RANGE SCAN | XIF1COCODEGROUP | 1 | | 2 (0)|
    |* 71 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 38 | 6 (17)|
    |* 72 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |* 73 | TABLE ACCESS FULL | CUSTOMACCESSDETAIL | 9 | 387 | 2 (0)|
    |* 74 | INDEX RANGE SCAN | COSEC_IDX_GG | 1 | 24 | 1 (0)|
    |* 75 | INDEX UNIQUE SCAN | SECURITY_GROUP_GG_U | 1 | 20 | |
    | 76 | VIEW | | 1 | 2032 | |
    | 77 | SORT UNIQUE | | 1 | 144 | 63 (0)|
    |* 78 | FILTER | | | | |
    | 79 | NESTED LOOPS | | 1 | 144 | 48 (3)|
    | 80 | NESTED LOOPS | | 1 | 142 | 37 (3)|
    | 81 | NESTED LOOPS | | 1 | 104 | 32 (4)|
    | 82 | NESTED LOOPS | | 1 | 84 | 31 (4)|
    | 83 | NESTED LOOPS | | 1 | 60 | 26 (4)|
    |* 84 | TABLE ACCESS BY INDEX ROWID | COCODEGROUP | 1 | 34 | 21 (5)|
    |* 85 | INDEX RANGE SCAN | XIF1COCODEGROUP | 9 | | 2 (0)|
    |* 86 | INDEX RANGE SCAN | UQ_SECURITYOBJECT | 1 | 26 | 1 (0)|
    |* 87 | INDEX RANGE SCAN | COSEC_IDX_GG | 1 | 24 | 1 (0)|
    |* 88 | INDEX UNIQUE SCAN | SECURITY_GROUP_GG_U | 1 | 20 | |
    |* 89 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 38 | 6 (17)|
    |* 90 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |* 91 | COLLECTION ITERATOR PICKLER FETCH| F_STR2TBL_PX16 | | | |
    | 92 | VIEW | | 1 | 43 | |
    |* 93 | FILTER | | | | |
    | 94 | SORT GROUP BY | | 1 | 183 | 55 (0)|
    |* 95 | FILTER | | | | |
    | 96 | NESTED LOOPS | | 1 | 183 | 40 (3)|
    | 97 | NESTED LOOPS | | 1 | 163 | 39 (3)|
    |* 98 | HASH JOIN OUTER | | 1 | 139 | 34 (3)|
    | 99 | NESTED LOOPS | | 1 | 96 | 31 (4)|
    | 100 | NESTED LOOPS | | 1 | 58 | 26 (4)|
    |*101 | TABLE ACCESS BY INDEX ROWID | COCODEGROUP | 1 | 32 | 21 (5)|
    |*102 | INDEX RANGE SCAN | XIF1COCODEGROUP | 9 | | 2 (0)|
    |*103 | INDEX RANGE SCAN | UQ_SECURITYOBJECT | 1 | 26 | 1 (0)|
    |*104 | TABLE ACCESS BY INDEX ROWID | ASSOCIATE | 1 | 38 | 6 (17)|
    |*105 | INDEX UNIQUE SCAN | ASSOCIATE_GG_U | 1 | | |
    |*106 | TABLE ACCESS FULL | CUSTOMACCESSDETAIL | 9 | 387 | 2 (0)|
    |*107 | INDEX RANGE SCAN | COSEC_IDX_GG | 1 | 24 | 1 (0)|
    |*108 | INDEX UNIQUE SCAN | SECURITY_GROUP_GG_U | 1 | 20 | |
    Predicate Information (identified by operation id):
    3 - filter(DECODE("SYS_ALIAS_19"."OID",NULL,1,NVL( (SELECT /*+ */ 1 FROM "PAYX_R16"."PAYROLLAGREEMENT"
    "PX16_PAYROLLAGREEMENT" WHERE :B1='C69C1Y' AND :B2=:B3 AND :B4=:B5 AND
    "PX16_PAYROLLAGREEMENT"."FILE_NUMBER"=TO_NUMBER(:B6) AND "PX16_PAYROLLAGREEMENT"."COCODEOID"=:B7 AND
    "PX16_PAYROLLAGREEMENT"."CIDN"=:B8 AND "PX16_PAYROLLAGREEMENT"."APPOINTMENTOID"=:B9),0))=1 AND
    (SYS_CONTEXT('payx_r16_app_context','app_role')='ADP' OR
    SYS_CONTEXT('payx_r16_app_context','app_role')='CSR' OR EXISTS (SELECT /*+ */ 0 FROM
    "PAYX_R16"."PCP_USER" "PX16_PCP_USER","PAYX_R16"."ASSOCIATE" "PX16_ASSOCIATE","PAYX_R16"."USERPROFILE"
    "PX16_USERPROFILE","PAYX_R16"."LINK" "PX16_LINK" WHERE :B10='C69C1Y' AND
    "PX16_LINK"."PARENTOID"="PX16_USERPROFILE"."OID" AND "PX16_LINK"."CIDN"='C69C1Y' AND
    "PX16_LINK"."CIDN"=:B11 AND "PX16_USERPROFILE"."CIDN"='C69C1Y' AND UPPER("PX16_USERPROFILE"."NAME")='SUPER
    USER' AND "PX16_USERPROFILE"."CIDN"=:B12 AND "PX16_ASSOCIATE"."CIDN"=:B13 AND
    "PX16_ASSOCIATE"."OID"="PX16_PCP_USER"."OID" AND "PX16_ASSOCIATE"."ACTIVE"=1 AND
    UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')) AND
    "PX16_PCP_USER"."USERPROFILEOID"="PX16_USERPROFILE"."OID" AND "PX16_PCP_USER"."CIDN"='C69C1Y' AND
    "PX16_PCP_USER"."USERPROFILEOID" IS NOT NULL AND "PX16_PCP_USER"."CIDN"=:B14) OR EXISTS (SELECT /*+ */ 0
    FROM TABLE("CRUVPD"."F_STR2TBL_PX16"("PX16_COCODEGROUP"."DEPARTMENT_ACCESS"))
    "KOKBF$","PAYX_R16"."SECURITY_GROUP" "PX16_SECURITY_GROUP","PAYX_R16"."COCODEGROUP_SECURITYGROUP"
    "PX16_COCODEGRP_SECURITYGRP","PAYX_R16"."SECURITYOBJECT" "PX16_SECURITYOBJECT","PAYX_R16"."ASSOCIATE"
    "PX16_ASSOCIATE","PAYX_R16"."COCODEGROUP" "PX16_COCODEGROUP" WHERE :B15='C69C1Y' AND
    "PX16_COCODEGROUP"."CIDN"=:B16 AND "PX16_COCODEGROUP"."CO_CODE"=:B17 AND "PX16_ASSOCIATE"."CIDN"='C69C1Y'
    AND "PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND
    UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')) AND
    "PX16_ASSOCIATE"."CIDN"=:B18 AND "PX16_SECURITYOBJECT"."CIDN"='C69C1Y' AND
    SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3)=:B19 AND "PX16_SECURITYOBJECT"."CIDN"=:B20 AND
    "PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"=:B21 AND "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y' AND
    "PX16_SECURITY_GROUP"."CIDN"='C69C1Y' AND "PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GR
    OUP"."OID" AND "PX16_SECURITY_GROUP"."CIDN"=:B22 AND VALUE(KOKBF$)=:B23) OR EXISTS (SELECT /*+ */ 0 FROM
    "PAYX_R16"."CUSTOMACCESSDETAIL" "PX16_CUSTOMACCESSDETAIL","PAYX_R16"."SECURITY_GROUP"
    "PX16_SECURITY_GROUP","PAYX_R16"."COCODEGROUP_SECURITYGROUP"
    "PX16_COCODEGRP_SECURITYGRP","PAYX_R16"."SECURITYOBJECT" "PX16_SECURITYOBJECT","PAYX_R16"."ASSOCIATE"
    "PX16_ASSOCIATE","PAYX_R16"."COCODEGROUP" "PX16_COCODEGROUP" WHERE "PX16_COCODEGROUP"."CIDN"='C69C1Y' AND
    "PX16_COCODEGROUP"."CIDN"="PX16_SECURITYOBJECT"."CIDN" AND
    "PX16_COCODEGROUP"."CO_CODE"=SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3) AND "PX16_ASSOCIATE"."CIDN"='C69C1Y'
    AND "PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND
    UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')) AND
    "PX16_COCODEGROUP"."CIDN"="PX16_ASSOCIATE"."CIDN" AND "PX16_SECURITYOBJECT"."CIDN"='C69C1Y' AND
    "PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGROUP"."CIDN"="PX16_COCODEGRP_SECURITYGRP"."CIDN" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y' AND "PX16_SECURITY_GROUP"."CIDN"='C69C1Y' AND
    "PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GROUP"."OID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"="PX16_SECURITY_GROUP"."CIDN" AND
    "PX16_COCODEGROUP"."CIDN"="PX16_CUSTOMACCESSDETAIL"."CIDN"(+) AND
    "PX16_COCODEGROUP"."OID"="PX16_CUSTOMACCESSDETAIL"."COCODEGROUPOID"(+) AND
    "PX16_CUSTOMACCESSDETAIL"."CIDN"(+)='C69C1Y' GROUP BY
    "PX16_COCODEGROUP"."CIDN","PX16_COCODEGROUP"."CO_CODE","PX16_CUSTOMACCESSDETAIL"."CODE" HAVING
    "PX16_COCODEGROUP"."CIDN"=:B24 AND "PX16_COCODEGROUP"."CO_CODE"=:B25 AN)
    13 - filter("PX16_USERPROFILE"."CIDN"='C69C1Y')
    14 - access("PX16_LINK"."CIDN"='C69C1Y' AND "PX16_LINK"."CHILDOID"='SYS:5:7478' AND
    "PX16_LINK"."PARENTOID"="PX16_USERPROFILE"."OID")
    filter("PX16_LINK"."CIDN"="PX16_USERPROFILE"."CIDN")
    16 - access("PX16_PCP_USER"."CIDN"='C69C1Y' AND "PX16_PCP_USER"."USERPROFILEOID"="PX16_USERPROFILE"."OID"
    filter("PX16_PCP_USER"."USERPROFILEOID" IS NOT NULL AND
    "PX16_PCP_USER"."CIDN"="PX16_USERPROFILE"."CIDN")
    17 - filter("PX16_ASSOCIATE"."ACTIVE"=1 AND UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_ap
    p_context','app_userid')))
    18 - access("PX16_ASSOCIATE"."OID"="PX16_PCP_USER"."OID" AND "PX16_ASSOCIATE"."CIDN"='C69C1Y')
    filter("PX16_ASSOCIATE"."CIDN"="PX16_PCP_USER"."CIDN")
    19 - filter("SYS_ALIAS_32"."ACTIVE"=1)
    20 - access("SYS_ALIAS_32"."CIDN"='C69C1Y')
    filter("SYS_ALIAS_32"."CIDN"="PX16_ASSOCIATE"."CIDN")
    22 - access("SYS_ALIAS_15"."CIDN"='C69C1Y' AND "SYS_ALIAS_32"."OID"="SYS_ALIAS_15"."CHECKHISTORYOID")
    filter("SYS_ALIAS_32"."CIDN"="SYS_ALIAS_15"."CIDN")
    24 - access("SYS_ALIAS_21"."CIDN"='C69C1Y' AND "SYS_ALIAS_21"."CO_CODE"="SYS_ALIAS_32"."CO_CODE")
    filter("SYS_ALIAS_21"."CIDN"="SYS_ALIAS_32"."CIDN")
    26 - access("SYS_ALIAS_32"."EMPLOYMENTOID"="SYS_ALIAS_11"."OID" AND "SYS_ALIAS_11"."CIDN"='C69C1Y')
    filter("SYS_ALIAS_32"."CIDN"="SYS_ALIAS_11"."CIDN")
    28 - access("SYS_ALIAS_11"."PERSONOID"="PX16_PERSON"."OID" AND "PX16_PERSON"."CIDN"='C69C1Y')
    filter("SYS_ALIAS_11"."CIDN"="PX16_PERSON"."CIDN")
    30 - access("SYS_ALIAS_19"."CIDN"(+)='C69C1Y' AND "SYS_ALIAS_19"."EMPLOYMENTOID"(+)="SYS_ALIAS_11"."OID")
    filter("SYS_ALIAS_19"."CIDN"(+)="SYS_ALIAS_11"."CIDN")
    31 - filter(:B1='C69C1Y' AND :B2=:B3 AND :B4=:B5)
    32 - filter("PX16_PAYROLLAGREEMENT"."APPOINTMENTOID"=:B1)
    33 - access("PX16_PAYROLLAGREEMENT"."CIDN"=:B1 AND "PX16_PAYROLLAGREEMENT"."COCODEOID"=:B2 AND
    "PX16_PAYROLLAGREEMENT"."FILE_NUMBER"=TO_NUMBER(:B3))
    34 - filter(:B1='C69C1Y')
    38 - filter(UPPER("PX16_USERPROFILE"."NAME")='SUPER USER')
    39 - access("PX16_USERPROFILE"."CIDN"='C69C1Y')
    filter("PX16_USERPROFILE"."CIDN"=:B1)
    40 - access("PX16_LINK"."CIDN"='C69C1Y' AND "PX16_LINK"."PARENTOID"="PX16_USERPROFILE"."OID")
    filter("PX16_LINK"."CIDN"=:B1)
    42 - access("PX16_PCP_USER"."CIDN"='C69C1Y' AND "PX16_PCP_USER"."USERPROFILEOID"="PX16_USERPROFILE"."OID"
    filter("PX16_PCP_USER"."USERPROFILEOID" IS NOT NULL AND "PX16_PCP_USER"."CIDN"=:B1)
    43 - filter("PX16_ASSOCIATE"."ACTIVE"=1 AND UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_ap
    p_context','app_userid')))
    44 - access("PX16_ASSOCIATE"."OID"="PX16_PCP_USER"."OID" AND "PX16_ASSOCIATE"."CIDN"=:B1)
    45 - filter(:B1='C69C1Y')
    51 - filter("PX16_COCODEGROUP"."CO_CODE"=:B1)
    52 - access("PX16_COCODEGROUP"."CIDN"=:B1)
    53 - filter(UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')))
    54 - access("PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND "PX16_ASSOCIATE"."CIDN"='C69C1Y')
    filter("PX16_ASSOCIATE"."CIDN"=:B1)
    55 - access("PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGRP_SECURITYGRP"."CIDN"=:B1 AND "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    56 - access("PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GROUP"."OID" AND
    "PX16_SECURITY_GROUP"."CIDN"='C69C1Y')
    filter("PX16_SECURITY_GROUP"."CIDN"=:B1)
    58 - access("PX16_SECURITYOBJECT"."CIDN"='C69C1Y')
    filter(SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3)=:B1 AND "PX16_SECURITYOBJECT"."CIDN"=:B2)
    59 - filter(VALUE(KOKBF$)=:B1)
    60 - filter("PX16_COCODEGROUP"."CIDN"=:B1 AND "PX16_COCODEGROUP"."CO_CODE"=:B2 AND
    "PX16_CUSTOMACCESSDETAIL"."CODE"=:B3)
    64 - access("PX16_COCODEGROUP"."OID"="PX16_CUSTOMACCESSDETAIL"."COCODEGROUPOID"(+) AND
    "PX16_COCODEGROUP"."CIDN"="PX16_CUSTOMACCESSDETAIL"."CIDN"(+))
    66 - access("PX16_COCODEGROUP"."CO_CODE"=SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3) AND
    "PX16_COCODEGROUP"."CIDN"="PX16_SECURITYOBJECT"."CIDN")
    68 - access("PX16_SECURITYOBJECT"."CIDN"='C69C1Y')
    70 - access("PX16_COCODEGROUP"."CIDN"='C69C1Y')
    71 - filter(UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')))
    72 - access("PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND "PX16_ASSOCIATE"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_ASSOCIATE"."CIDN")
    73 - filter("PX16_CUSTOMACCESSDETAIL"."CIDN"(+)='C69C1Y')
    74 - access("PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_COCODEGRP_SECURITYGRP"."CIDN" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    75 - access("PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GROUP"."OID" AND
    "PX16_SECURITY_GROUP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGRP_SECURITYGRP"."CIDN"="PX16_SECURITY_GROUP"."CIDN")
    78 - filter('C69C1Y'=:B1)
    84 - filter("PX16_COCODEGROUP"."CO_CODE"=:B1)
    85 - access("PX16_COCODEGROUP"."CIDN"='C69C1Y')
    86 - access("PX16_SECURITYOBJECT"."CIDN"='C69C1Y')
    filter(SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3)=:B1 AND
    "PX16_COCODEGROUP"."CIDN"="PX16_SECURITYOBJECT"."CIDN")
    87 - access("PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_COCODEGRP_SECURITYGRP"."CIDN" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    88 - access("PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GROUP"."OID" AND
    "PX16_SECURITY_GROUP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGRP_SECURITYGRP"."CIDN"="PX16_SECURITY_GROUP"."CIDN")
    89 - filter(UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')))
    90 - access("PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND "PX16_ASSOCIATE"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_ASSOCIATE"."CIDN")
    91 - filter(VALUE(KOKBF$) IS NULL)
    93 - filter(COUNT(DISTINCT "PX16_CUSTOMACCESSDETAIL"."CODE")=0)
    95 - filter('C69C1Y'=:B1)
    98 - access("PX16_COCODEGROUP"."OID"="PX16_CUSTOMACCESSDETAIL"."COCODEGROUPOID"(+) AND
    "PX16_COCODEGROUP"."CIDN"="PX16_CUSTOMACCESSDETAIL"."CIDN"(+))
    101 - filter("PX16_COCODEGROUP"."CO_CODE"=:B1)
    102 - access("PX16_COCODEGROUP"."CIDN"='C69C1Y')
    103 - access("PX16_SECURITYOBJECT"."CIDN"='C69C1Y')
    filter(SUBSTR("PX16_SECURITYOBJECT"."NAME",8,3)=:B1 AND
    "PX16_COCODEGROUP"."CIDN"="PX16_SECURITYOBJECT"."CIDN")
    104 - filter(UPPER("PX16_ASSOCIATE"."NAME")=UPPER(SYS_CONTEXT('payx_r16_app_context','app_userid')))
    105 - access("PX16_COCODEGROUP"."USEROID"="PX16_ASSOCIATE"."OID" AND "PX16_ASSOCIATE"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_ASSOCIATE"."CIDN")
    106 - filter("PX16_CUSTOMACCESSDETAIL"."CIDN"(+)='C69C1Y')
    107 - access("PX16_COCODEGROUP"."OID"="PX16_COCODEGRP_SECURITYGRP"."COCODEGROUPOID" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGROUP"."CIDN"="PX16_COCODEGRP_SECURITYGRP"."CIDN" AND
    "PX16_COCODEGRP_SECURITYGRP"."CIDN"='C69C1Y')
    108 - access("PX16_COCODEGRP_SECURITYGRP"."SECURITYGROUPOID"="PX16_SECURITY_GROUP"."OID" AND
    "PX16_SECURITY_GROUP"."CIDN"='C69C1Y')
    filter("PX16_COCODEGRP_SECURITYGRP"."CIDN"="PX16_SECURITY_GROUP"."CIDN")
    277 rows selected.
    Really need advice on it.

    Without formatting using [ PRE ] and [ /PRE ] tags it is nearly impossible to read much less provide help.
    But what is it you hope to accomplish by breaking it up into smaller views?
    Improvements in ease of maintenance will likely be offset by poorer performance.

  • Enhance Tuning to a Key for a Single Track

    I am looking to enhance the tuning for a single track but when I go to enhance one track it enhances the tuning for all the tracks. Does anyone know of a way to just enhance the tuning for a single track? Or maybe a way to just export one track out of several?
    Thanks

    Well I'm just calling it what Garageband is calling it. At the top it says "Garageband, File, Edit, and then Track. Where you can add, delete, and duplicate a track. When you select "Create New Track" you then can choose from Software Instrument, Real Instrument, or Electric Guitar. I think you are thinking of a Track as a Project. When you first start Garageband the top one says _*New Project*_ and the bottom one says _*Recent Projects*_.
    And I know you can move it to a New Project. I was muting all the other Tracks in a project except for the one that I wanted in a certain key and then I exported it to iTunes and then stuck it right back in as a song. So I know how to do it that way but I was wondering if there was an easier way where I didn't need to export and import tracks all the time.

  • Need help on tuning materialized view refresh

    Hi All,
    I am working on materialized view refresh tuning.Initially it was complete refresh and used to take more than 90 mins to complete.
    I changed it to fast refresh now it is completing fast. Now i have partitioned the base tables gl_balances and gl_code_combinations of column code_combination_id and created a local index on column code_combination_id then i am trying to partition the materialized on the same column to take advantage of partition change tracking.
    Size of gl_balances base tables is 40Gb and all others tables sizes are small. In where clause there all the 4 tables are mapped. If i will create the partition only on code_combination_id will i the materialized will become the candidate for partition change tracking. As i know it will be applicable for PCT. I need expert advice on this.
    While doing a fast refresh. the refresh takes less time. when there is a change in gl_balances , gl_code_combinations or gl_periods it completes in 20-30 mins. When there is a change in gl_set_of_books tables. It creates a problem here.DEL query takes more than 48 hours to complete.
    CREATE MATERIALIZED VIEW apps.BAL_PART
    REFRESH FAST ON DEMAND
    ENABLE QUERY REWRITE as
    SELECT GL.GL_CODE_COMBINATIONS21.ROWID C1,GL.GL_BALANCES21.ROWID C2, GL.GL_SETS_OF_BOOKS.ROWID C3,
    GL.GL_PERIOD.ROWID C4,
    "GL"."GL_BALANCES21"."ACTUAL_FLAG" ,
    "GL"."GL_BALANCES21"."CURRENCY_CODE" ,
    "GL"."GL_BALANCES21"."PERIOD_NUM" ,
    "GL"."GL_BALANCES21"."PERIOD_YEAR" ,
    "GL"."GL_BALANCES21"."SET_OF_BOOKS_ID" "SOB_ID",
    "GL"."GL_CODE_COMBINATIONS21"."CODE_COMBINATION_ID" "CCID",
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT1" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT10" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT11" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT12" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT13" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT14" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT2" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT3" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT4" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT5" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT6" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT7" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT8" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT9" ,
    "GL"."GL_PERIODS"."PERIOD_NAME" ,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) Open_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Close_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) -
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Period_Cr,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Period_Dr
    FROM GL.GL_CODE_COMBINATIONS21,
    GL.GL_BALANCES21,
    GL.GL_SETS_OF_BOOKS,
    GL.GL_PERIODS
    WHERE GL.GL_BALANCES21.CODE_COMBINATION_ID =GL.GL_CODE_COMBINATIONS21.CODE_COMBINATION_ID
    AND GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID = GL.GL_BALANCES21.SET_OF_BOOKS_ID
    AND GL.GL_PERIODS.PERIOD_NUM = GL.GL_BALANCES21.PERIOD_NUM
    AND GL.GL_PERIODS.PERIOD_YEAR = GL.GL_BALANCES21.PERIOD_YEAR
    AND GL.GL_PERIODS.PERIOD_TYPE = GL.GL_BALANCES21.PERIOD_TYPE
    AND GL.GL_PERIODS.PERIOD_NAME = GL.GL_BALANCES21.PERIOD_NAME
    AND GL.GL_PERIODS.PERIOD_SET_NAME = GL.GL_SETS_OF_BOOKS.PERIOD_SET_NAME
    and gl.GL_CODE_COMBINATIONS21.summary_flag != 'Y'TRACE 1046 del statement
    DELETE FROM "APPS"."apps.BAL_PART" SNA$
    WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT 
      CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM "GL"."MLOG$_GL_SETS_OF_BOOKS"
      "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1 ) AS OF SNAPSHOT(:B_SCN) MAS$)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1  17759.00  171782.99  159422121    1267371 2564144739           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2  17759.00  171782.99  159422121    1267371 2564144739           0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 175  (APPS)   (recursive depth: 1)
    Rows     Row Source Operation
          0  DELETE  apps.BAL_PART (cr=0 pr=0 pw=0 time=0 us)
    193128740   NESTED LOOPS  (cr=592437 pr=592422 pw=0 time=945244160 us cost=339302 size=168 card=1)
          3    SORT UNIQUE (cr=7 pr=0 pw=0 time=15832 us cost=2 size=138 card=1)
         24     TABLE ACCESS FULL MLOG$_GL_SETS_OF_BOOKS (cr=7 pr=0 pw=0 time=19 us cost=2 size=138 card=1)
    193128740    INDEX RANGE SCAN C3BOOKS (cr=592430 pr=592422 pw=0 time=789499200 us cost=339299 size=3318314250 card=110610475)(object id 2114736)
    error during execute of EXPLAIN PLAN statement
    ORA-08187: snapshot expression not allowed here
    parse error offset: 314
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                   159520897        2.12     144415.96
      latch: cache buffers chains                   134        0.06          0.68
      latch: undo global data                        33        0.02          0.15
      latch: object queue header operation          521        0.02          0.53
      log file switch (private strand flush incomplete)
                                                    532        0.31         28.26
      resmgr:cpu quantum                            155        1.40         13.49
      resmgr:internal state change                   25        0.11          2.21
      latch free                                     10        0.00          0.00
      latch: cache buffers lru chain                  4        0.00          0.00
      rdbms ipc reply                               489        0.02          0.54
      reliable message                              587        0.00          0.56
      latch: row cache objects                        3        0.00          0.00
    ********************************************************************************GL_SETS_OF_BOOKS has only 6 rows. I know there is complete refresh as a option which will again take more than 90 mins.
    I want to do the fast refresh. Tables rows details below.
    SQL> select count(*) from gl.gl_code_combinations21;
    COUNT(*)
    3075255
    SQL> select count(*) from gl.GL_PERIODS;
    COUNT(*)
    1160
    SQL> select count(*) from gl.gl_balances21;
    COUNT(*)
    477613527
    SQL> select count(*) from gl.gl_sets_of_books;
    COUNT(*)
    6gl_sets_of_books has less rows. Whenever there is a change then it mapped to huge rows hence during materialized view has delete huge number of rows.
    select count(*) from apps.BAL_PART group by C3;
    C3 is the rowid which is present in create materialized statement.
    COUNT(*)
    292927011
    210215
    69330
    184406971
    Is there any way to improve the plan. As i created a partition on code_combination_id and local index on code_combination_id which will not help in set_of_books_id case. I dont PCT will help here or not. Is it possible to use PCT refresh by equipartitioning only one column in where clause.
    Please assist me in improving refresh of materialized view using fast refresh.
    Thanks and Regards,
    Edited by: user646034 on Feb 23, 2013 11:13 PM
    Edited by: user646034 on Feb 23, 2013 11:19 PM
    Edited by: user646034 on Feb 23, 2013 11:46 PM
    Edited by: user646034 on Feb 25, 2013 11:46 AM

    Hi
    The below explain without index and with index.
    /* MV_REFRESH (DEL) */ DELETE FROM "APPS"."BAL_PART                                                                                                                                                                                                                                                                                                                                                                                                                
    " SNA$ WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    "GL"."MLOG$_GL_SETS_OF_BOOKS" "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    ) AS OF SNAPSHOT(:B_SCN) MAS$)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    Plan hash value: 2704021294                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Id  | Operation            | Name                          | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   0 | DELETE STATEMENT     |                               |        |       |   339K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   1 |  DELETE              | BAL_PART                          |        |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   2 |   NESTED LOOPS       |                               |      1 |   168 |   339K  (1)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   3 |    SORT UNIQUE       |                               |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   4 |     TABLE ACCESS FULL| MLOG$_GL_SETS_OF_BOOKS        |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   5 |    INDEX RANGE SCAN  | C3BOOKS                       |    110M|  3164M|   339K  (0)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    If i will not use the C3 index then the query will use the belolw plan, I guess this will also take same time or more time.
    |   0 | DELETE STATEMENT       |                               |        |       |  9743K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    |   1 |  DELETE                | BAL_PART                          |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                     

  • Oracle  11g Performance tuning approach ?

    Hello Experts,
    Is it the right forum to follow oracle performance tuning discussions ? If not, let me know what will be the forum to pick up some thread on this subject.
    I am looking for performance tuning approach for oracle 11g. I learned there are some new items in 11g in this regard. For persons, who did tuning in earlier versions of Oracle,
    what will be the best way adopt to 11 g?
    I reviewed the 11g performance tuning guide, but I am looking for some white papers/blogs with case studies and practical approaches. I hope that you have used them.
    What are the other sources to pick up some discussions?
    Do you mind, share your thoughts?
    Thanks in advance.
    RI

    The best sources of information on performance tuning are:
    1. Jonathan Lewis: http://jonathanlewis.wordpress.com/all-postings/
    2. Christian Antognini: http://www.antognini.ch/
    3. Tanel Poder: http://blog.tanelpoder.com/
    4. Richard Foote: http://richardfoote.wordpress.com/
    5. Cary Millsap: http://carymillsap.blogspot.com/
    and a few dozen others whose blogs you will find cross-referenced in those above.

  • Need help to debug SQL Tuning Advisor Error Message

    Hi,
    I am getting an error message while try to get recommendations from the SQL Tuning Advisor.
    Environment:
    Oracle Version:  11.2.0.3.0
    O/S: AIX
    Following is my code:
    declare
    my_task_name  varchar2 (30);
    my_sqltext    clob;
    begin
    my_sqltext := 'SELECT DISTINCT MRKT_AREA AS DIVISION, PROMO_ID,
                    PROMO_CODE,
                    RBR_DTL_TYPE.PERF_DETL_TYP, 
                    RBR_DTL_TYPE.PERF_DETL_DESC,
                    RBR_DTL_TYPE.PERF_DETL_SUB_TYP,
                    RBR_DTL_TYPE.PERF_DETL_SUB_DESC,
                    BU_SYS_ITM_NUM,
                    RBR_CPN_LOC_ITEM_ARCHIVE.CLI_SYS_ITM_DESC,
                    PROMO_START_DATE,
                    PROMO_END_DATE,
                    PROMO_VALUE2,
                    PROMO_VALUE1,
                    EXEC_COMMENTS,
                    PAGE_NUM,
                    BLOCK_NUM,
                    AD_PLACEMENT,
                    BUYER_CODE,
                    RBR_CPN_LOC_ITEM_ARCHIVE.CLI_STAT_TYP,
                    RBR_MASTER_CAL_ARCHIVE.STATUS_FLAG
    FROM  (PROMO_REPT_OWNER.RBR_CPN_LOC_ITEM_ARCHIVE
    INNER JOIN PROMO_REPT_OWNER.RBR_MASTER_CAL_ARCHIVE
    ON (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_PROMO_ID = PROMO_ID)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_PERF_DTL_ID = PERF_DETAIL_ID)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_STR_NBR = STORE_ZONE)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_ITM_ID = ITM_ID))
    INNER JOIN PROMO_REPT_OWNER.RBR_DTL_TYPE
    ON (RBR_MASTER_CAL_ARCHIVE.PERF_DETL_TYP = RBR_DTL_TYPE.PERF_DETL_TYP)
    AND (RBR_MASTER_CAL_ARCHIVE.PERF_DETL_SUB_TYP = RBR_DTL_TYPE.PERF_DETL_SUB_TYP)
    WHERE ( ((MRKT_AREA)=40)
    AND ((RBR_DTL_TYPE.PERF_DETL_TYP)=1)
    AND ((RBR_DTL_TYPE.PERF_DETL_SUB_TYP)=1) )
    AND ((CLI_STAT_TYP)=1 Or (CLI_STAT_TYP)=6)
    AND ((RBR_MASTER_CAL_ARCHIVE.STATUS_FLAG)=''A'')
    AND ( ((PROMO_START_DATE) >= to_date(''2011-10-20'', ''YYYY-MM-DD'')
    And (PROMO_END_DATE) <= to_date(''2011-10-26'', ''YYYY-MM-DD'')) )
    ORDER BY MRKT_AREA';
    my_task_name := dbms_sqltune.create_tuning_task
                                 (sql_text => my_sqltext,
                                  user_name => 'PROMO_REPT_OWNER',
                                  scope     => 'COMPREHENSIVE',
                                  time_limit => 3600,
                                  task_name  => 'Test_Query',
                                  description  => 'Test Query');
    end;
    begin
      dbms_sqltune.execute_tuning_task(task_name => 'Test_Query');
    end;
    set serveroutput on size unlimited;
    set pagesize 5000
    set linesize 130
    set long 50000
    set longchunksize 500000
    SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('Test_Query') FROM DUAL;
    Output:
    snippet .....
    FINDINGS SECTION (1 finding)
    1- Index Finding (see explain plans section below)
    The execution plan of this statement can be improved by creating one or more
    indices.
    Recommendation (estimated benefit: 71.48%)
    - Consider running the Access Advisor to improve the physical schema design
    or creating the recommended index.
    Error: Cannot fetch actions for recommendation: INDEX
    Error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Rationale
    Creating the recommended indices significantly improves the execution plan
    of this statement. However, it might be preferable to run "Access Advisor"
    using a representative SQL workload as opposed to a single statement. This
    will allow to get comprehensive index recommendations which takes into
    account index maintenance overhead and additional space consumption.
    snippet
    Any ideas why I am getting ORA-06502 error?
    Thanks in advance
    Rogers

    Bug 14407401 - ORA-6502 from index recommendation section of DBMS_SQLTUNE output (Doc ID 14407401.8)
    Fixed:
    The fix for 14407401 is first included in
    12.1.0.1 (Base Release)

  • Sql tuning help

    Hi,
    I need some help on tuning this sql. We run a third party application and I have to ask thrid party for any changes. I have pasted the session statistice from the run for this sql.
    SELECT DECODE( RPAD(NVL(NWKPCDOUTWDPOSTCODE,' '),4,
    ' ')||RPAD(NVL(NWKPCDINWDPOSTCODE,' '),3,' '),
    RPAD(NVL(:zipout1,' '),4,' ')||RPAD(NVL(:zipin1,' '),3,' '),
    '0001', RPAD(NVL(:zipout2,' '),4,'
    ')||RPAD(SUBSTR(NVL(:zipin2,' '),0,1),3,' '), '0002',
    RPAD(NVL(:zipout3,' '),7,' '), '0003',
    RPAD('ZZ999',7,' '), '0004' ) AS CHECKER
    FROM NWKPCDREC
    WHERE NWKPCDNETWORKID = :netid
    AND NWKPCDSORTPOINT1TYPE != 'XXXXXXXX'
    AND ( (RPAD(NVL(NWKPCDOUTWDPOSTCODE,' '),4,' ')||RPAD(NVL(NWKPCDINWDPOSTCODE,' '),3,' ') =
    RPAD(NVL(:zipout4,' '),4,' ')||RPAD(NVL(:zipin3,' '),3,' '))
    OR (RPAD(NVL(NWKPCDOUTWDPOSTCODE,' '),4,'
    ')||RPAD(NVL(NWKPCDINWDPOSTCODE,' '),3,' ') =
    RPAD(NVL(:zipout5,' '),4,' ')||RPAD(SUBSTR(NVL(:zipin4,' '),0,
    1),3,' ')) OR (RPAD(NVL(NWKPCDOUTWDPOSTCODE,' '),4,'
    ')||RPAD(NVL(NWKPCDINWDPOSTCODE,' '),3,' ') =
    RPAD(NVL(:zipout6,' '),7,' ')) OR
    (RPAD(NVL(NWKPCDOUTWDPOSTCODE,' '),4,'
    ')||RPAD(NVL(NWKPCDINWDPOSTCODE,' '),3,' ') = RPAD('ZZ999',7,
    ' ')) ) ORDER BY CHECKER
    Session Statistics 09 October 2007 22:44:56 GMT+00:00
    Report Target : PRD1 (Database)
    Session Statistics
    (Chart form was tabular, see data table below)
    SID Name Value Class
    37 write clones created in foreground 0 Cache
    37 write clones created in background 0 Cache
    37 user rollbacks 16 User
    37 user commits 8674 User
    37 user calls 302838 User
    37 transaction tables consistent reads - undo records applied 0 Debug
    37 transaction tables consistent read rollbacks 0 Debug
    37 transaction rollbacks 9 Debug
    37 transaction lock foreground wait time 0 Debug
    37 transaction lock foreground requests 0 Debug
    37 transaction lock background gets 0 Debug
    37 transaction lock background get time 0 Debug
    37 total file opens 12 Cache
    37 table scans (short tables) 8062 SQL
    37 table scans (rowid ranges) 0 SQL
    37 table scans (long tables) 89 SQL
    37 table scans (direct read) 0 SQL
    37 table scans (cache partitions) 2 SQL
    37 table scan rows gotten 487042810 SQL
    37 table scan blocks gotten 7327924 SQL
    37 table fetch continued row 17 SQL
    37 table fetch by rowid 26130550 SQL
    37 switch current to new buffer 6400 Cache
    37 summed dirty queue length 0 Cache
    37 sorts (rows) 138607 SQL
    37 sorts (memory) 13418 SQL
    37 sorts (disk) 0 SQL
    37 session uga memory max 5176776 User
    37 session uga memory 81136 User
    37 session stored procedure space 0 User
    37 session pga memory max 5559884 User
    37 session pga memory 5559884 User
    37 session logical reads 115050107 User
    37 session cursor cache hits 0 SQL
    37 session cursor cache count 0 SQL
    37 session connect time 1191953042 User
    37 serializable aborts 0 User
    37 rows fetched via callback 1295545 SQL
    37 rollbacks only - consistent read gets 0 Debug
    37 rollback changes - undo records applied 114 Debug
    37 remote instance undo header writes 0 Global Cache
    37 remote instance undo block writes 0 Global Cache
    37 redo writes 0 Redo
    37 redo writer latching time 0 Redo
    37 redo write time 0 Redo
    37 redo wastage 0 Redo
    37 redo synch writes 8683 Cache
    37 redo synch time 722 Cache
    37 redo size 25463692 Redo
    37 redo ordering marks 0 Redo
    37 redo log switch interrupts 0 Redo
    37 redo log space wait time 0 Redo
    37 redo log space requests 1 Redo
    37 redo entries 81930 Redo
    37 redo buffer allocation retries 1 Redo
    37 redo blocks written 0 Redo
    37 recursive cpu usage 101 User
    37 recursive calls 84413 User
    37 recovery blocks read 0 Cache
    37 recovery array reads 0 Cache
    37 recovery array read time 0 Cache
    37 queries parallelized 0 Parallel Server
    37 process last non-idle time 1191953042 Debug
    37 prefetched blocks aged out before use 0 Cache
    37 prefetched blocks 1436767 Cache
    37 pinned buffers inspected 89 Cache
    37 physical writes non checkpoint 3507 Cache
    37 physical writes direct (lob) 0 Cache
    37 physical writes direct 3507 Cache
    37 physical writes 3507 Cache
    37 physical reads direct (lob) 0 Cache
    37 physical reads direct 2499 Cache
    37 physical reads 1591668 Cache
    37 parse time elapsed 336 SQL
    37 parse time cpu 315 SQL
    37 parse count (total) 28651 SQL
    37 parse count (hard) 1178 SQL
    37 opens requiring cache replacement 0 Cache
    37 opens of replaced files 0 Cache
    37 opened cursors current 51 User
    37 opened cursors cumulative 28651 User
    37 no work - consistent read gets 59086317 Debug
    37 no buffer to keep pinned count 0 Other
    37 next scns gotten without going to DLM 0 Parallel Server
    37 native hash arithmetic fail 0 SQL
    37 native hash arithmetic execute 0 SQL
    37 messages sent 9730 Debug
    37 messages received 0 Debug
    37 logons current 1 User
    37 logons cumulative 1 User
    37 leaf node splits 111 Debug
    37 kcmgss waited for batching 0 Parallel Server
    37 kcmgss read scn without going to DLM 0 Parallel Server
    37 kcmccs called get current scn 0 Parallel Server
    37 instance recovery database freeze count 0 Parallel Server
    37 index fast full scans (rowid ranges) 0 SQL
    37 index fast full scans (full) 210 SQL
    37 index fast full scans (direct read) 0 SQL
    37 immediate (CURRENT) block cleanout applications 4064 Debug
    37 immediate (CR) block cleanout applications 83 Debug
    37 hot buffers moved to head of LRU 20004 Cache
    37 global lock sync gets 0 Parallel Server
    37 global lock sync converts 0 Parallel Server
    37 global lock releases 0 Parallel Server
    37 global lock get time 0 Parallel Server
    37 global lock convert time 0 Parallel Server
    37 global lock async gets 0 Parallel Server
    37 global lock async converts 0 Parallel Server
    37 global cache read buffer lock timeouts 0 Global Cache
    37 global cache read buffer blocks served 0 Global Cache
    37 global cache read buffer blocks received 0 Global Cache
    37 global cache read buffer block timeouts 0 Global Cache
    37 global cache read buffer block send time 0 Global Cache
    37 global cache read buffer block receive time 0 Global Cache
    37 global cache read buffer block build time 0 Global Cache
    37 global cache prepare failures 0 Global Cache
    37 global cache gets 0 Global Cache
    37 global cache get time 0 Global Cache
    37 global cache freelist waits 0 Global Cache
    37 global cache defers 0 Global Cache
    37 global cache cr timeouts 0 Global Cache
    37 global cache cr requests blocked 0 Global Cache
    37 global cache cr blocks served 0 Global Cache
    37 global cache cr blocks received 0 Global Cache
    37 global cache cr block send time 0 Global Cache
    37 global cache cr block receive time 0 Global Cache
    37 global cache cr block flush time 0 Global Cache
    37 global cache cr block build time 0 Global Cache
    37 global cache converts 0 Global Cache
    37 global cache convert timeouts 0 Global Cache
    37 global cache convert time 0 Global Cache
    37 global cache blocks corrupt 0 Global Cache
    37 free buffer requested 1597281 Cache
    37 free buffer inspected 659 Cache
    37 execute count 128826 SQL
    37 exchange deadlocks 1 Cache
    37 enqueue waits 0 Enqueue
    37 enqueue timeouts 0 Enqueue
    37 enqueue requests 23715 Enqueue
    37 enqueue releases 23715 Enqueue
    37 enqueue deadlocks 0 Enqueue
    37 enqueue conversions 0 Enqueue
    37 dirty buffers inspected 437 Cache
    37 deferred (CURRENT) block cleanout applications 21937 Debug
    37 db block gets 230801 Cache
    37 db block changes 160407 Cache
    37 data blocks consistent reads - undo records applied 460 Debug
    37 cursor authentications 488 Debug
    37 current blocks converted for CR 0 Cache
    37 consistent gets 114819307 Cache
    37 consistent changes 460 Cache
    37 commit cleanouts successfully completed 37201 Cache
    37 commit cleanouts 37210 Cache
    37 commit cleanout failures: write disabled 0 Cache
    37 commit cleanout failures: hot backup in progress 0 Cache
    37 commit cleanout failures: cannot pin 0 Cache
    37 commit cleanout failures: callback failure 3 Cache
    37 commit cleanout failures: buffer being written 0 Cache
    37 commit cleanout failures: block lost 6 Cache
    37 cold recycle reads 0 Cache
    37 cluster key scans 17 SQL
    37 cluster key scan block gets 36 SQL
    37 cleanouts only - consistent read gets 83 Debug
    37 cleanouts and rollbacks - consistent read gets 0 Debug
    37 change write time 108 Cache
    37 calls to kcmgrs 0 Debug
    37 calls to kcmgcs 391 Debug
    37 calls to kcmgas 8816 Debug
    37 calls to get snapshot scn: kcmgss 171453 Parallel Server
    37 bytes sent via SQL*Net to dblink 0 User
    37 bytes sent via SQL*Net to client 25363874 User
    37 bytes received via SQL*Net from dblink 0 User
    37 bytes received via SQL*Net from client 29829542 User
    37 buffer is pinned count 540816 Other
    37 buffer is not pinned count 86108905 Other
    37 branch node splits 6 Debug
    37 background timeouts 0 Debug
    37 background checkpoints started 0 Cache
    37 background checkpoints completed 0 Cache
    37 Unnecesary process cleanup for SCN batching 0 Parallel Server
    37 SQL*Net roundtrips to/from dblink 0 User
    37 SQL*Net roundtrips to/from client 302837 User
    37 Parallel operations not downgraded 0 Parallel Server
    37 Parallel operations downgraded to serial 0 Parallel Server
    37 Parallel operations downgraded 75 to 99 pct 0 Parallel Server
    37 Parallel operations downgraded 50 to 75 pct 0 Parallel Server
    37 Parallel operations downgraded 25 to 50 pct 0 Parallel Server
    37 Parallel operations downgraded 1 to 25 pct 0 Parallel Server
    37 PX remote messages sent 0 Parallel Server
    37 PX remote messages recv'd 0 Parallel Server
    37 PX local messages sent 0 Parallel Server
    37 PX local messages recv'd 0 Parallel Server
    37 OS Voluntary context switches 0 OS
    37 OS User time used 0 OS
    37 OS System time used 0 OS
    37 OS Swaps 0 OS
    37 OS Socket messages sent 0 OS
    37 OS Socket messages received 0 OS
    37 OS Signals received 0 OS
    37 OS Page reclaims 0 OS
    37 OS Page faults 0 OS
    37 OS Maximum resident set size 0 OS
    37 OS Involuntary context switches 0 OS
    37 OS Integral unshared stack size 0 OS
    37 OS Integral unshared data size 0 OS
    37 OS Integral shared text size 0 OS
    37 OS Block output operations 0 OS
    37 OS Block input operations 0 OS
    37 DML statements parallelized 0 Parallel Server
    37 DFO trees parallelized 0 Parallel Server
    37 DDL statements parallelized 0 Parallel Server
    37 DBWR undo block writes 0 Cache
    37 DBWR transaction table writes 0 Cache
    37 DBWR summed scan depth 0 Cache
    37 DBWR revisited being-written buffer 0 Cache
    37 DBWR make free requests 0 Cache
    37 DBWR lru scans 0 Cache
    37 DBWR free buffers found 0 Cache
    37 DBWR cross instance writes 0 Global Cache
    37 DBWR checkpoints 0 Cache
    37 DBWR checkpoint buffers written 0 Cache
    37 DBWR buffers scanned 0 Cache
    37 Commit SCN cached 0 Debug
    37 Cached Commit SCN referenced 1 Debug
    37 CR blocks created 203 Cache
    37 CPU used when call started 280528 Debug
    37 CPU used by this session 280528 User
    Regards
    Raj
    --------------------------------------------------------------------------------

    Thank you everybody for helping me out while tuning the query. I have managed to bring down the run time from 60 minutes to 12 minutes.
    I am posting the exisitng query, existing database objects ddl and the new query and new ddl to share my learning. This is my first use of forum, senior members, please letme know if I shouldn't have put all this here.
    /pre original code
    SELECT decode(rpad(nvl(a.nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(
    a.nwkpcdinwdpostcode, ' '), 3, ' '), rpad(nvl(:zipout1, ' '), 4, ' ')
    || rpad(nvl(:zipin1, ' '), 3, ' '), '0001', rpad(nvl(:zipout2, ' '), 4,
    ' ') || rpad(substr(nvl(:zipin2, ' '), 0, 1), 3, ' '), '0002',
    rpad(nvl(:zipout3, ' '), 7, ' '), '0003', rpad('ZZ999', 7, ' '), '0004')
    AS checker, a.nwkpcdbarcode1to7 nwkpcdbarcode1to7,
    a.nwkpcdbarcode15 nwkpcdbarcode15,
    a.nwkpcdbarcodeseqkey nwkpcdbarcodeseqkey,
    a.nwkpcdsortpoint1code nwkpcdsortpoint1code,
    a.nwkpcdsortpoint1type nwkpcdsortpoint1type,
    a.nwkpcdsortpoint1name nwkpcdsortpoint1name,
    a.nwkpcdsortpoint1extra nwkpcdsortpoint1extra,
    a.nwkpcdsortpoint2type nwkpcdsortpoint2type,
    a.nwkpcdsortpoint2name nwkpcdsortpoint2name,
    a.nwkpcdsortpoint3type nwkpcdsortpoint3type,
    a.nwkpcdsortpoint3name nwkpcdsortpoint3name,
    a.nwkpcdsortpoint4type nwkpcdsortpoint4type,
    a.nwkpcdsortpoint4name nwkpcdsortpoint4name,
    b.nwkprfnetworksequence nwkprfnetworksequence,
    b.nwkprfnetworkid nwkprfnetworkid, b.nwkprfnetworkname nwkprfnetworkname,
    b.nwkprfminweight / 100 AS nwkprfminweight, b.nwkprfmaxweight / 100 AS
    nwkprfmaxweight, b.nwkprfminlengthgirth nwkprfminlengthgirth,
    b.nwkprfmaxlengthgirth nwkprfmaxlengthgirth,
    b.nwkprfminlength nwkprfminlength, b.nwkprfmaxlength nwkprfmaxlength,
    b.nwkprfparceltypecode nwkprfparceltypecode,
    b.nwkprfparceltypename nwkprfparceltypename
    FROM wh1.nwkpcdrec a, wh1.nwkprefrec b
    WHERE a.nwkpcdnetworkid = b.nwkprfnetworkid
    AND a.nwkpcdsortpoint1type != 'XXXXXXXX'
    AND (rpad(nvl(a.nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(
    a.nwkpcdinwdpostcode, ' '), 3, ' ') = rpad(nvl(:zipout4, ' '), 4, ' '
    ) || rpad(nvl(:zipin3, ' '), 3, ' ')
    OR rpad(nvl(a.nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(
    a.nwkpcdinwdpostcode, ' '), 3, ' ') = rpad(nvl(:zipout5, ' '), 4, ' '
    ) || rpad(substr(nvl(:zipin4, ' '), 0, 1), 3, ' ')
    OR rpad(nvl(a.nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(
    a.nwkpcdinwdpostcode, ' '), 3, ' ') = rpad(nvl(:zipout6, ' '), 7, ' '
    OR rpad(nvl(a.nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(
    a.nwkpcdinwdpostcode, ' '), 3, ' ') = rpad('ZZ999', 7, ' '))
    AND :weight1 >= b.nwkprfminweight
    AND :weight2 <= b.nwkprfmaxweight
    AND b.nwkprfminlengthgirth <= 60
    AND b.nwkprfmaxlengthgirth >= 60
    AND b.nwkprfminlength <= 15
    AND b.nwkprfmaxlength >= 15
    ORDER BY b.nwkprfnetworkid, checker
    CREATE TABLE "WH1"."NWKPCDREC" ("NWKPCDFILECODE" VARCHAR2(2),
    "NWKPCDRECORDTYPE" VARCHAR2(4), "NWKPCDNETWORKID" VARCHAR2(2),
    "NWKPCDOUTWDPOSTCODE" VARCHAR2(4), "NWKPCDINWDPOSTCODE"
    VARCHAR2(3), "NWKPCDSORTPOINT1CODE" VARCHAR2(2),
    "NWKPCDSORTPOINT1TYPE" VARCHAR2(8), "NWKPCDSORTPOINT1NAME"
    VARCHAR2(16), "NWKPCDSORTPOINT1EXTRA" VARCHAR2(16),
    "NWKPCDSORTPOINT2TYPE" VARCHAR2(8), "NWKPCDSORTPOINT2NAME"
    VARCHAR2(8), "NWKPCDSORTPOINT3TYPE" VARCHAR2(8),
    "NWKPCDSORTPOINT3NAME" VARCHAR2(8), "NWKPCDSORTPOINT4TYPE"
    VARCHAR2(8), "NWKPCDSORTPOINT4NAME" VARCHAR2(8), "NWKPCDPPI"
    VARCHAR2(8), "NWKPCDBARCODE1TO7" VARCHAR2(7),
    "NWKPCDBARCODE15" VARCHAR2(1), "NWKPCDBARCODESEQKEY"
    VARCHAR2(7), "NWKPCDFILLER1" VARCHAR2(7), "NWKPCDFILLER2"
    VARCHAR2(30),
    CONSTRAINT "UK_NWKPCDREC" UNIQUE("NWKPCDNETWORKID",
    "NWKPCDOUTWDPOSTCODE", "NWKPCDINWDPOSTCODE")
    USING INDEX
    TABLESPACE "WH1_INDEX"
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
    PCTFREE 10 INITRANS 2 MAXTRANS 255)
    TABLESPACE "WH1_DATA_LARGE" PCTFREE 10 PCTUSED 40 INITRANS 1
    MAXTRANS 255
    STORAGE ( INITIAL 4096K NEXT 4096K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
    NOLOGGING
    pre original script/
    /pre modified script
    CREATE TABLE "WH1"."NWKPCEREC_OLD" ("NWKPCDFILECODE" VARCHAR2(2),
    "NWKPCDRECORDTYPE" VARCHAR2(4), "NWKPCDNETWORKID" VARCHAR2(2),
    "NWKPCDOUTWDPOSTCODE" VARCHAR2(4), "NWKPCDINWDPOSTCODE"
    VARCHAR2(3), "NWKPCDSORTPOINT1CODE" VARCHAR2(2),
    "NWKPCDSORTPOINT1TYPE" VARCHAR2(8), "NWKPCDSORTPOINT1NAME"
    VARCHAR2(16), "NWKPCDSORTPOINT1EXTRA" VARCHAR2(16),
    "NWKPCDSORTPOINT2TYPE" VARCHAR2(8), "NWKPCDSORTPOINT2NAME"
    VARCHAR2(8), "NWKPCDSORTPOINT3TYPE" VARCHAR2(8),
    "NWKPCDSORTPOINT3NAME" VARCHAR2(8), "NWKPCDSORTPOINT4TYPE"
    VARCHAR2(8), "NWKPCDSORTPOINT4NAME" VARCHAR2(8), "NWKPCDPPI"
    VARCHAR2(8), "NWKPCDBARCODE1TO7" VARCHAR2(7),
    "NWKPCDBARCODE15" VARCHAR2(1), "NWKPCDBARCODESEQKEY"
    VARCHAR2(7), "NWKPCDFILLER1" VARCHAR2(7), "NWKPCDFILLER2"
    VARCHAR2(30))
    TABLESPACE "WH1_DATA_LARGE" PCTFREE 10 PCTUSED 40 INITRANS 1
    MAXTRANS 255
    STORAGE ( INITIAL 4096K NEXT 4096K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
    NOLOGGING
    insert into wh1.nwkpcdrec_old select * from wh1.nwkpcdrec;
    drop table wh1.nwkpcdrec;
    CREATE TABLE "WH1"."NWKPCDREC" ("NWKPCDFILECODE" VARCHAR2(2),
    "NWKPCDRECORDTYPE" VARCHAR2(4), "NWKPCDNETWORKID" VARCHAR2(2),
    "NWKPCDOUTINWDPOSTCODE" VARCHAR2(7) NOT NULL,
    "NWKPCDOUTWDPOSTCODE" VARCHAR2(4), "NWKPCDINWDPOSTCODE"
    VARCHAR2(3), "NWKPCDSORTPOINT1CODE" VARCHAR2(2),
    "NWKPCDSORTPOINT1TYPE" VARCHAR2(8), "NWKPCDSORTPOINT1NAME"
    VARCHAR2(16), "NWKPCDSORTPOINT1EXTRA" VARCHAR2(16),
    "NWKPCDSORTPOINT2TYPE" VARCHAR2(8), "NWKPCDSORTPOINT2NAME"
    VARCHAR2(8), "NWKPCDSORTPOINT3TYPE" VARCHAR2(8),
    "NWKPCDSORTPOINT3NAME" VARCHAR2(8), "NWKPCDSORTPOINT4TYPE"
    VARCHAR2(8), "NWKPCDSORTPOINT4NAME" VARCHAR2(8), "NWKPCDPPI"
    VARCHAR2(8), "NWKPCDBARCODE1TO7" VARCHAR2(7),
    "NWKPCDBARCODE15" VARCHAR2(1), "NWKPCDBARCODESEQKEY"
    VARCHAR2(7), "NWKPCDFILLER1" VARCHAR2(7), "NWKPCDFILLER2"
    VARCHAR2(30))
    TABLESPACE "WH1_DATA_LARGE" PCTFREE 10 PCTUSED 40 INITRANS 1
    MAXTRANS 255
    STORAGE ( INITIAL 4096K NEXT 4096K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
    NOLOGGING
    INSERT INTO WH1.NWKPCDREC SELECT
                   NWKPCDFILECODE,
                   NWKPCDRECORDTYPE,
                   NWKPCDNETWORKID,
                   rpad(nvl(nwkpcdoutwdpostcode, ' '), 4, ' ') || rpad(nvl(nwkpcdinwdpostcode, ' '), 3, ' '),
                   nwkpcdoutwdpostcode,
                   nwkpcdinwdpostcode,
                   NWKPCDSORTPOINT1CODE,
                   NWKPCDSORTPOINT1TYPE,
                   NWKPCDSORTPOINT1NAME,
                   NWKPCDSORTPOINT1EXTRA,
                   NWKPCDSORTPOINT2TYPE,
                   NWKPCDSORTPOINT2NAME,
                   NWKPCDSORTPOINT3TYPE,
                   NWKPCDSORTPOINT3NAME,
                   NWKPCDSORTPOINT4TYPE,
                   NWKPCDSORTPOINT4NAME,
                   NWKPCDPPI,
                   NWKPCDBARCODE1TO7,
                   NWKPCDBARCODE15,
                   NWKPCDBARCODESEQKEY,
                   NWKPCDFILLER1,
                   NWKPCDFILLER2
    FROM WH1.NWKPCDREC_OLD;
    CREATE UNIQUE INDEX "WH1"."UK_NWKPCDREC"
    ON "WH1"."NWKPCDREC" ("NWKPCDNETWORKID",
    "NWKPCDOUTINWDPOSTCODE")
    TABLESPACE "WH1_INDEX" PCTFREE 10 INITRANS 2 MAXTRANS
    255
    STORAGE ( INITIAL 8192K NEXT 8192K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
    LOGGING
    begin
    dbms_stats.gather_table_stats(ownname=> 'WH1', tabname=> 'NWKPCDREC', partname=> NULL);
    end;
    begin
    dbms_stats.gather_index_stats(ownname=> 'WH1', indname=> 'UK_NWKPCDREC', partname=> NULL);
    end;
    SELECT decode(a.nwkpcdoutinwdpostcode, rpad(nvl(:zipout1, ' '), 4, ' ') ||
    rpad(nvl(:zipin1, ' '), 3, ' '), '0001', rpad(nvl(:zipout2, ' '), 4, ' '
    ) || rpad(substr(nvl(:zipin2, ' '), 0, 1), 3, ' '), '0002', rpad(
    nvl(:zipout3, ' '), 7, ' '), '0003', rpad('ZZ999', 7, ' '), '0004') AS
    checker, a.nwkpcdbarcode1to7 nwkpcdbarcode1to7,
    a.nwkpcdbarcode15 nwkpcdbarcode15,
    a.nwkpcdbarcodeseqkey nwkpcdbarcodeseqkey,
    a.nwkpcdsortpoint1code nwkpcdsortpoint1code,
    a.nwkpcdsortpoint1type nwkpcdsortpoint1type,
    a.nwkpcdsortpoint1name nwkpcdsortpoint1name,
    a.nwkpcdsortpoint1extra nwkpcdsortpoint1extra,
    a.nwkpcdsortpoint2type nwkpcdsortpoint2type,
    a.nwkpcdsortpoint2name nwkpcdsortpoint2name,
    a.nwkpcdsortpoint3type nwkpcdsortpoint3type,
    a.nwkpcdsortpoint3name nwkpcdsortpoint3name,
    a.nwkpcdsortpoint4type nwkpcdsortpoint4type,
    a.nwkpcdsortpoint4name nwkpcdsortpoint4name,
    b.nwkprfnetworksequence nwkprfnetworksequence,
    b.nwkprfnetworkid nwkprfnetworkid, b.nwkprfnetworkname nwkprfnetworkname,
    b.nwkprfminweight / 100 AS nwkprfminweight, b.nwkprfmaxweight / 100 AS
    nwkprfmaxweight, b.nwkprfminlengthgirth nwkprfminlengthgirth,
    b.nwkprfmaxlengthgirth nwkprfmaxlengthgirth,
    b.nwkprfminlength nwkprfminlength, b.nwkprfmaxlength nwkprfmaxlength,
    b.nwkprfparceltypecode nwkprfparceltypecode,
    b.nwkprfparceltypename nwkprfparceltypename
    FROM wh1.nwkpcdrec a, wh1.nwkprefrec b
    WHERE a.nwkpcdnetworkid = b.nwkprfnetworkid
    AND a.nwkpcdoutinwdpostcode IN (rpad(nvl(:zipout4, ' '), 4, ' ') ||
    rpad(nvl(:zipin3, ' '), 3, ' '), rpad(nvl(:zipout5, ' '), 4, ' ')
    || rpad(substr(nvl(:zipin4, ' '), 0, 1), 3, ' '), rpad(nvl(:zipout6,
    ' '), 7, ' '), rpad('ZZ999', 7, ' '))
    AND a.nwkpcdsortpoint1type != 'XXXXXXXX'
    AND :weight1 >= b.nwkprfminweight
    AND :weight2 <= b.nwkprfmaxweight
    AND b.nwkprfminlengthgirth <= 60
    AND b.nwkprfmaxlengthgirth >= 60
    AND b.nwkprfminlength <= 15
    AND b.nwkprfmaxlength >= 15
    ORDER BY b.nwkprfnetworkid, checker
    pre modified script/

  • Whats the difference between these two queries ? - for tuning purpose

    Whats the difference between these two queries ?
    I have huge amount of data for each table. its takeing such a long time (>5-6hrs).
    here whice one is fast / do we have any other option there apart from listed here....
    QUERY 1: 
      SELECT  --<< USING INDEX >>
          field1, field2, field3, sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end)
        FROM
          tab1 inner join tab2 on condition1 inner join tab3 on condition2 inner join tab4 on conditon3
        WHERE
         condition4..10 and
        GROUP BY
          field1, field2,field3
        HAVING
          sum( case when field4 in (1,2) then 1 when field4 in (3,4) then -1 else 0 end) <> 0;
    QUERY 2:
       SELECT  --<< USING INDEX >>
          field1, field2, field3, sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0))
        FROM
          tab1, tab2, tab3, tab4
        WHERE
         condition1 and
         condition2 and
         condition3 and
         condition4..10
        GROUP BY
          field1, field2,field3
        HAVING
          sum( decode(field4, 1, 1, 2, 1, 3, -1, 4, -1 ,0)) <> 0;
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    My feeling here is that simply changing join syntax and case vs decode issues is not going to give any significant improvement in performance, and as Tubby points out, there is not a lot to go on. I think you are going to have to investigate things along the line of parallel query and index vs full table scans as well any number of performance tuning methods before you will see any significant gains. I would start with the Performance Manual as a start and then follow that up with the hard yards of query plans and stats.
    Alternatively, you could just set the gofast parameter to TRUE and everything will be all right.
    Andre

  • Can I get my Macbook Pro just checked out and tuned up at the genius bar?

    I'm having a hard time getting my questions answered. Basically I've had my Macbook Pro for four and a half years, but it's still doing mostly fine. It's just showing it's age slightly I think, with more spinning wheels than usual and odd things like the date is usually set to 1999 when I turn the computer on, but it rights itself in a few minutes. Also most the time when I plug it in it says it's not charging and I have to try multiple times. None of this is a huge deal, it's just that I really need the computer to last me preferably at least another year, so I worry about it a bit. I do take good care of it though. I'm about to move out of the country for a year, so I'd like to get it just checked out and perhaps tuned up a bit so that any problems are taken care of and it's in the best shape before I move away. I'd like to make a genius bar appointment, but the closest Apple store is a two hour drive from my home, so I don't want to go into it not having any idea how much it will cost or if they'll even be able to do what I'm hoping in the span of a single workday. I really don't want to have to drive back later to pick it up or have it sent off somewhere to be repaired, although if it does have serious problems I'd be willing to do that. I'd just like to know going in to it what the price range is likely to be like. I don't want to make the drive to the Apple store and have them tell me it's going to be a few hundred dollars just to have my computer looked over. And I don't even know if they offer that service, let alone if they can do it in a single afternoon. I've tried calling the store and conversations with the automated person really are not helpful. He just tells me to go online and make a reservation, and I can't figure out how to get my questions about cost and service answered.
    Also, am I being foolish hoping my four and a half year old Macbook will last at least another year or two? I have no idea what the "life expectancy" is for these things. I know nothing really about computers at all, so forgive my ignorance.
    Any help and insight is very much appreciated.

    The genius bar technicians can check your MBP for possible hardware problems and specific software issues that you may have.  The diagnosis will be free.  Any extensive repairs will not be free.
    If you have minor software problems, you essentially will have to deal with them yourself.  Examine these two comprehensive documents for possible problem definition and solutions.  If you encounter problems that you are unable to cope with, start a new discussion and there will be persons willing to assist you in solving them.
    https://discussions.apple.com/docs/DOC-3521
    https://discussions.apple.com/docs/DOC-3353
    Ciao.

  • Can We Have a Perfomance Tuning Forum?

    Justin,
    There are forums for Upgrade, Installation, Backup/Recovery & RMAN.But there is none for performance tuning. All the questions about the reports ie Statspack/AWR, Sql queries, they are pushed in the Database General forum only. With heavy volume of generic questions coming there, these threads bury inside them. I have been asked couple of times by several people/friends that why there is not any dedicated OTN forum for Performance Tuning? So if community and you think its a good thing to do, can we have a dedicated DB Performance Tuning forum too?
    Regards
    Aman....

    Aman,
    SQL queries tunning is not same as database tunning. Furthermore, most of the SQL queries tunning question go into SQL & PL/SQL forums.
    Moreover, more you have forums, more difficult is to find active knowledge people in every single forum. We cannot track many forums as well as few of them depending of your interest.
    See, few months ago, the Upgrade forum has been created, and since, only 153 posts there, it is not very used. Why ?
    It has been discuss many times over here, have a dedicated forum by features/interest, or have a big one.
    I don't find really strange db tunning question in the database general forum. I think even the upgrade question there have their place in that forum.
    If any new forum is created, the knowledge people have to follow to maintain that forum popular, which is not sure at all. Whether we are agreed to spend our time over the forums, that'll become very complicated to be active in more than 3 or 4 forums even if there is interest.
    See, OTN has upgraded the forum software for a better service, I don't think it has been reach. So, let's keep it simple.
    Nicolas.

Maybe you are looking for

  • Unable to open dashboards in presentation services

    Hi All, I have recently installed BI applications in my system.After installtion I am unable to open dashboards.Answers and delivers all the others are working fine. When I click on the dashboard link it is giving the following error "access denied f

  • Yosemite filevault stuck, battery drain

    Hello i enabled filevault after the yosemite update last week and its been stuck encrypting ever since. the estimated time jumps from 60 days to 1.800 days and so on. Corestoragd uses a lot of CPU, can I delete it to solve this? Thanks Best regards

  • ORA -00054 Errors in system log

    Regards dhrish

  • Why do I have to browse all my email contact in the phone app?

    When browsing for a phone number in my contact list from the phone app, why do I have to browse through the 100's of contacts for which I just have an email address with no phone number? Thanks

  • IPhone Mail Sending from Different Accounts

    I have taken a look and cannot see anything on this topic - but I am having trouble with my iPhone sending emails from different accounts. I have 5 IMAP accounts setup for different emails. When I go to send from one account, it seems to send from my