Tuning cpu sensitive db

Hi,Experts,
Could I use some benchmark parameter to tune the cpu sensitive db.(oracle 10.2.0.4 on solaris)
such as db_block_checksum, db_block_checking.
and if oracle will approve below parameters
collectundo_stats=false
dbcache_pre_warm=FALSE
undoautotune = false
checkblock_after_checksum = false
inmemory_undo=false
cursorcache_frame_bind_memory = true
lmfile_affinity=something
Thanks
Simon Lai

When you say 300 MHz, do you really mean a Sun T1000 or T2000 system with a Niagara T1 processor? At 1.2 GHz with 8 cores and 4 threads each core, this is effectively 32 * 300 MHz CPUs. In which case my strongest advice is buy another system and throw this one out. The Niagara processors are well known as being very bad for running real world Oracle database on - in spite of everything Sun may say about them.
For instance read this Pythian blog entry:
http://www.pythian.com/blogs/1499/sunfire-t2000-servers-are-best-suited-for-oracle-middletier
If you have a real 300 MHz CPU, my advice is pretty much the same. You could easily replace this system with a PC running Linux using an Intel Core2 Dual or Quad Core CPU at over 2 GHz for under $1,000 at my guess. And the Intel CPUs today will beat hands down a 300 MHz CPU.
Really, if the slow CPU is that much of a problem, then replace the hardware. Everything will run much faster as a result. The last time I came across a 300 MHz CPU was around 1998, which is over 11 years ago. Moore's Law says that CPUs double in performance every 1.5 years - so you have at least 10 times improvement in CPU speed since then! Why are you using such slow CPUs?
John

Similar Messages

  • Performance Tuning for ECC 6.0

    Hi All,
      I have an ECC 6.0EP 7.0(ABAPJAVA). My system is very slow. I have Oracle 10.2.0.1.
      Can you please guide me how to do these steps in the sytem
    1) Reorganization should be done at least for the top 10 huge tables
    and their indexes
    2) Unaccessed data can be taken out by SAP Archiving
    3)Apply the relevant corrections for top sap standard objects
    4) CBO update statistics must be latest for all SAP and customer objects
    I have never done performance tuning and want to do it on this system.
    Regards,
    Jitender

    Hi,
    Below are the details of ST06. Please suggest me what should I do. the system performance is very bad.
    I require your inputs for performance tuning
    CPU
    Utilization  user    %                   3     Count                                    2
                  system  %                   3      Load average  1min                0.11
                  idle    %                       1                         5 min                0.21
                  io wait %                    93                       15 min                0.22
    System calls/s                        982  Context switches/s                    1752
    Interrupts/s                          4528
    Memory
    Physical mem avail  Kb             6291456 Physical mem free   Kb               93992
    Pages in/s                             473 Kb paged in/s                         3784
    Pages out/s                            211 Kb paged out/s                        1688
    Pool
    Configured swap     Kb            26869896 Maximum swap-space  Kb            26869896
    Free in swap-space  Kb            21631032 Actual swap-space   Kb            26869896
    Disk with highest response time
    Name                                   md3 Response time       ms                  51
    Utilization                              2     Queue                                    0
    Avg wait time       ms              0    Avg service time    ms                  51
    Kb transfered/s                       2   Operations/s                             0
    Current parameters in the system
    System:        sapretail_RET_01          Profile Parameters for SAP Buffers
    Date and Time: 08.01.2009       13:27:54
    Buffer Name                    Comment
    Profile Parameter             Value      Unit  Comment
    Program buffer                 PXA
    abap/buffersize               450000     kB    Size of program buffer
    abap/pxa                      shared           Program buffer mode
    |
    CUA buffer                     CUA
    rsdb/cua/buffersize           3000       kB    Size of CUA buffer
    The number of max. buffered CUA objects is always: size / (2 kB)
                                                                                    |
    Screen buffer                  PRES
    zcsa/presentation_buffer_area 4400000    Byte  Size of screen buffer
    sap/bufdir_entries            2000             Max. number of buffered screens
    |
    Generic key table buffer       TABL
    zcsa/table_buffer_area        30000000   Byte  Size of generic key table buffer
    zcsa/db_max_buftab            5000             Max. number of buffered objects
    |
    Single record table buffer     TABLP
    rtbb/buffer_length            10000      kB    Size of single record table buffer
    rtbb/max_tables               500              Max. number of buffered tables
    |
    Export/import buffer           EIBUF
    rsdb/obj/buffersize           4096       kB    Size of export/import buffer
    rsdb/obj/max_objects          2000             Max. number of objects in the buffer
    rsdb/obj/large_object_size    8192       Bytes Estimation for the size of the largest object
    rsdb/obj/mutex_n              0                Number of mutexes in Export/Import buffer
    |
    OTR buffer                     OTR
    rsdb/otr/buffersize_kb        4096       kB    Size of OTR buffer
    rsdb/otr/max_objects          2000             Max. number of objects in the buffer
    rsdb/otr/mutex_n              0                Number of mutexes in OTR buffer
    |
    Exp/Imp SHM buffer             ESM
    rsdb/esm/buffersize_kb        4096       kB    Size of exp/imp SHM buffer
    rsdb/esm/max_objects          2000             Max. number of objects in the buffer
    rsdb/esm/large_object_size    8192       Bytes Estimation for the size of the largest object
    rsdb/esm/mutex_n              0                Number of mutexes in Exp/Imp SHM buffer
    |
    Table definition buffer        TTAB
    rsdb/ntab/entrycount          20000            Max. number of table definitions buffered
    The size of the TTAB is nearly 100 bytes * rsdb/ntab/entrycount
                                                                                    |
    Field description buffer       FTAB
    rsdb/ntab/ftabsize            30000      kB    Size of field description buffer
    rsdb/ntab/entrycount          20000            Max. number / 2 of table descriptions buffered
    FTAB needs about 700 bytes per used entry
                                                                                    |
    Initial record buffer          IRBD
    rsdb/ntab/irbdsize            6000       kB    Size of initial record buffer
    rsdb/ntab/entrycount          20000            Max. number / 2 of initial records buffered
    IRBD needs about 300 bytes per used entry
                                                                                    |
    Short nametab (NTAB)           SNTAB
    rsdb/ntab/sntabsize           3000       kB    Size of short nametab
    rsdb/ntab/entrycount          20000            Max. number / 2 of entries buffered
    SNTAB needs about 150 bytes per used entry
                                                                                    |
    Calendar buffer                CALE
    zcsa/calendar_area            500000     Byte  Size of calendar buffer
    zcsa/calendar_ids             200              Max. number of directory entries
    |
    Roll, extended and heap memory EXTM
    ztta/roll_area                3000000    Byte  Roll area per workprocess (total)
    ztta/roll_first               1          Byte  First amount of roll area used in a dialog WP
    ztta/short_area               3200000    Byte  Short area per workprocess
    rdisp/ROLL_SHM                16384      8 kB  Part of roll file in shared memory
    rdisp/PG_SHM                  8192       8 kB  Part of paging file in shared memory
    rdisp/PG_LOCAL                150        8 kB  Paging buffer per workprocess
    em/initial_size_MB            4092       MB    Initial size of extended memory
    em/blocksize_KB               4096       kB    Size of one extended memory block
    em/address_space_MB           4092       MB    Address space reserved for ext. mem. (NT only)
    ztta/roll_extension           2000000000 Byte  Max. extended mem. per session (external mode)
    abap/heap_area_dia            2000000000 Byte  Max. heap memory for dialog workprocesses
    abap/heap_area_nondia         2000000000 Byte  Max. heap memory for non-dialog workprocesses
    abap/heap_area_total          2000000000 Byte  Max. usable heap memory
    abap/heaplimit                40000000   Byte  Workprocess restart limit of heap memory
    abap/use_paging               0                Paging for flat tables used (1) or not (0)
    |
    Statistic parameters
    rsdb/staton                   1                Statistic turned on (1) or off (0)
    rsdb/stattime                 0                Times for statistic turned on (1) or off (0)
    Regards,
    Jitender

  • Virtualised Multi-Instance SQL Server Cluster - Processor Resource Management

    Hi - We're in the process of implementing a multi-instance SQL 2014 guest cluster on Windows 2012 R2.  To our dismay, it seems that Windows System Resource Manager (WSRM) is deprecated in Windows 2012 R2, so we're now stuck for how best to manage CPU usage
    between SQL instances....
    As far as I can see, I'm left with two options, but both of these have problems:
    1) Use SQL Processor affinity within the guest cluster, with each SQL instance assigned to dedicated v-CPU.  However, I'm not certain that setting SQL Processor affinity within a VM will actually have the desired affect!?..
    - When there is physical CPU capacity available, I'd hope Hyper-V would provide it to whichever v-CPU is demanding it.  
    - When VM processor demand exceeds the physical CPU capacity, I'd hope the SQL instances would receive a proportion of the physical CPU time according to the number of v-CPU(s) assigned through the affinity settings.
    2) Use a VM (actually 2, because its a 2-node guest cluster) per SQL instance!..  This is not ideal, as we need multiple SQL instances and it would result in have an administrative and performance overhead
    Does anyone have any information or thoughts on this?  How can we manage a virtualised multi-instance SQL deployment now that WSRM has been deprecated?  Help me please!

    I'm not sure what are the requirements for each of the 2 VMs in in the SQL guest cluster.
    I'm assuming the guest cluster resides on a Hyper-V CSV with at least 2 Hyper-V hosts, and the 2 VMs are configured with Anti-affinity to ensure they never reside on the same Hyper-V host.
    I've been able to configure CPU resources to VMs from the standard controls in Hyper-V Manager:
    See this blog post
    What edition of SQL 2014 you're using?
    This matters because of these limitations.
    Also consider running SQL Server with Hyper-V Dynamic Memory - see Best Practices
    and Considerations
    Hyper-V performance tuning - CPU
    Hyper-V 2012 Best Practices
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Oracle 8i & SMP config

    I'd like to know whether Oracle 8i supports SMP Linux kernel configuration?
    I would also like to know is it more advisable to use RedHat distribution with Oracle 8i or SuSe 6.3?
    Thank you in advance,
    Greg

    I believe it does, based on the Oracle8i Linux Adminstrator's Guide, Chapter 2, Tuning CPU Usage:
    ========================================
    Using Processor Affinity and Binding on Multi-Processor Systems
    In a multi-processor environment, use processor affinity and binding if it is available on your system. Processor binding prevents a process from migrating
    from one CPU to another, allowing the information in the CPU cache to be better utilized. You can bind a server shadow process to make use of the cache
    since it is always active, and let background processes flow between CPUs.
    ==========================================
    You do need to change your init.ora settings to enable using SMP, and the parallel query / execution option to be able to take advantage of this, which comes with the EE anyway.
    null

  • MOVED: MSI P6N SLI V2 - C2DE6750 - OverClock

    This topic has been moved to Overclockers & Modding Corner.
    https://forum-en.msi.com/index.php?topic=123250.0

    The board is limited in its oc capability.
    Do not expect miracles from a budgetboard.
    You might have simply reached the limit of it and yes I know it says higher on the box, but sorry, it doesnt always work.
    My slightly "bigger" brother of your board cant go any higher then where i am now (look at my sig for details).
    Any higher and either no boot or unstable.
    Also as you can see in your bios there are not much utilities for oc-ing (and the E6750 isnt an oc wonder and thats talking out of experience).
    No reference voltages are avalaible for fine tuning cpu or fsb, only Vcore, NB, SB, VDimm, FSB VTT and maybe 1 or 2 more and thats it I guess.
    Look at a expensive boards today and you got a ton of voltages and god knows what more and thats what you need to get higher.
    So again sorry, but me thinks thats the max with your current setup.

  • Tuning a sql to remove cpu intensive operations

    Along the simliar lines of the other thread but we want to tune a sql to reduce cpu impact. Its a complicated sql, joins subqueries, with etc.
    What tools/web pages/blogs should I focus on for this topic?
    An explain plan shows cpu .. is that showing the best picture? Is it that obvious? The i/o and overall cost is quite good at under 1000 and it seems the performance is okay at 1-2s .. but multiply that by a 1000 calls a second and we see cpu climb.
    Trying to get every last bit out of the boxes before tipping over the 96 cpus.
    I think I will take a stab at a complete re-write of the developers sql to see what can be done with a new set of eyes.
    I guess tkprof will show me cpu - if its large enough to show .. I suppose I can run it for all the variations that look promising.
    Daryl.

    Hi,
    Along the simliar lines of the other thread but we want to tune a sql to reduce cpu impact. Its a complicated sql, joins subqueries, with etc.
    What tools/web pages/blogs should I focus on for this topic?SQL plan will be best for you to understand what your query is doing.
    An explain plan shows cpu .. is that showing the best picture? Is it that obvious? The i/o and overall cost is quite good at under 1000 and it seems the performance is okay at 1-2s .. >but multiply that by a 1000 calls a second and we see cpu climb.How can you say that cost under 1000 is a good cost? You can have a query with a cost of 100 having execution time of 2 hours and a query with cost of 100000 retuning you within a few seconds. So, don't concentrate on the cost.
    If a query is returning in one second, and you are executing same query 1000 times within a seconds than query might not have a problem, rather you need to concentrate that how can you reduce the number of executions.
    I guess tkprof will show me cpu - if its large enough to show .. I suppose I can run it for all the variations that look promising.Do a 10046 tracing for your SQL and tkprof the trace file to see the time spent on each step of the query execution. Actually there are thousands of advices which you can take to improve your particular SQL and for this you will need to do a google.
    Salman

  • CPU bound and distinct select tuning (10g)

    Hi,
    I think that my database is CPU bound :
    Top 5 Timed Events Avg %Total
    ~~~~~~~~~~~~~~~~~~ wait Call
    Event Waits Time (s) (ms) Time
    CPU time 662 71.8
    db file sequential read 11,082 66 6 7.2
    control file sequential read 51,677 41 1 4.4
    db file scattered read 8,133 39 5 4.3
    SQL*Net more data to client 113,379 32 0 3.5
    ================
    ==================
    And such stmt's probably cause this issue :
    SQL ordered by CPU
    CPU CPU per Elapsd Old
    Time (s) Executions Exec (s) %Total Time (s) Buffer Gets Hash Value
    101.49 160 0.63 15.9 102.55 252,160 2426247326
    Module: dirdld.exe
    SELECT DISTINCT(APPNM) FROM APPLICATION ORDER BY APPNM
    ===============================================
    (SQL ordered by Gets)
    Buffer Gets Executions Gets per Exec %Total Time (s) Time (s) Hash Value
    713,149 33,280 21.4 13.3 39.67 42.70 2402103054
    Module: ORACLE.EXE
    INSERT INTO "PARAMETER" ("FAMNM","APPNM","PARTID","PARNAMELOC",
    "DLDTYPE","VALUE","FLAG","SEQINFO") VALUES (:B8,:B7,:B6,TRIM(:B5
    ),:B4,TRIM(:B3),:B2,:B1)
    489,906 114 4,297.4 9.1 20.16 29.46 2145980626
    Module: ORACLE.EXE
    DELETE FROM "PARAMETER" "A1" WHERE "A1"."PARTID"=:B1
    ============================
    ============================
    So is there any possiblility to tune this query ? :
    (it is already in keep buffer)
    SELECT DISTINCT(APPNM) FROM APPLICATION ORDER BY APPNM
    Plan
    SELECT STATEMENT ALL_ROWSCost: 1,008 Bytes: 859,080 Cardinality: 85,908
    3 SORT ORDER BY Cost: 1,008 Bytes: 859,080 Cardinality: 85,908
    2 HASH UNIQUE Cost: 659 Bytes: 859,080 Cardinality: 85,908
    1 TABLE ACCESS FULL TABLE VCESERVICE.APPLICATION Cost: 307 Bytes: 869,150 Cardinality: 86,915
    Best Regards Arkadiusz Masny

    Hi,
    Thank's Joe.
    But this query is hardcoded into application logic (standalone application).
    Is it possible to force oracle (application) to use materialized view instead of table ?
    Best Regards Arek Masny

  • Disco App Server high CPU usage, Disco Applet freezes, tuning possible?

    Hi again,
    so I am facing again a dramatic performance issue with our Discoverer.
    I have a cross-table report with ten page items, one datapoint, a percentage calculation and a total.
    After querying the data from the DB, building the report (calculating total and percentages) takes 50 seconds, Disco Applet is freezed, App Server shows high CPU load (one core about 60%, other three cores about 20%). The report fetches 5600 rows, which is quite nothing.
    Disco Version: 10.1.2.54.25 (CPU IV).
    Are there any parameters / settings on the application server to improve the performance at this place?
    Thanks in advance,
    Christian

    I found the solution for this special problem: the total in the report was the cause. Without it, the report reacts as I expect it.
    Nevertheless, other reports (approx. 300.000 rows of data in a crosstab) with four page items also cause this high CPU load on the AS and freeze Disco for some half a minute. Our costumers do complain about this as it always seems that Disco hung up.
    Any suggestions on how to tune the AS?
    Regards,
    Christian

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Cisco 7206 has with LLQ QOS and cpu 85 %

    hi all ,
    i want to mention issue about cisco router 7206 npeg2 :
    can this router handle traffic  780 Mbps  as download  and 75 MBps as upload ?? with cpu 85 % and with LLQ  qos ??
    im asking this question because my QOS althoug it matched alot of traffic , it some time get slow and seems that QOS not working fine , im sure that my work is  fine, because it was fine , but recent days i added more bw   ???!!!!!
    dont know if  need more memory for router for QOS :
    ===============================================================
    7200Gateway#sh memory
                    Head    Total(b)     Used(b)     Free(b)   Lowest(b)  Largest(b)
    Processor    6B97A80   1883669308   114125456   1769543852   1768174580   1760364316
          I/O   78000000    67108864     4482572    62626292    62598896    62617884
    Transient   77000000    16777216       22196    16755020    16222412    16728368
              Processor memory
    Address      Bytes     Prev     Next Ref     PrevF    NextF Alloc PC  what
    06B97A80 0000010004 00000000 06B9A1C4 001  -------- -------- 01A493D8  CEF: fib
    06B9A1C4 0000000028 06B97A80 06B9A210 000  87F3D04  87FD620  015FC24C  AAA Attr Binary/String
    06B9A210 0000004700 06B9A1C4 06B9B49C 001  -------- -------- 01AC85B4  ADJ: adjacency
    06B9B49C 0000004100 06B9A210 06B9C4D0 001  -------- -------- 0011245C  HTTP CORE
    06B9C4D0 0000004100 06B9B49C 06B9D504 001  -------- -------- 00112548  HTTP CORE
    06B9D504 0000004100 06B9C4D0 06B9E538 001  -------- -------- 00112548  HTTP CORE
    06B9E538 0000004100 06B9D504 06B9F56C 001  -------- -------- 00112548  HTTP CORE
    06B9F56C 0000004100 06B9E538 06BA05A0 001  -------- -------- 00112548  HTTP CORE
    06BA05A0 0000000756 06B9F56C 06BA08C4 001  -------- -------- 0343C38C  Process
    06BA08C4 0000000204 06BA05A0 06BA09C0 001  -------- -------- 0343FAB4  Process Events
    06BA09C0 0000022764 06BA08C4 06BA62DC 001  -------- -------- 04055CB4  IPSM Octet Str
    06BA62DC 0000014488 06BA09C0 06BA9BA4 001  -------- -------- 0405C0C4  ipsm IPSEC Fai
    06BA9BA4 0000004100 06BA62DC 06BAABD8 001  -------- -------- 00112548  H
    ===========================================================================
    ==========================================
    7200Gateway#sh version
    Cisco IOS Software, 7200 Software (C7200P-ADVENTERPRISEK9-M), Version 12.4(24)T7, RELEASE SOFTWARE (fc2)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2012 by Cisco Systems, Inc.
    Compiled Tue 28-Feb-12 12:53 by prod_rel_team
    ROM: System Bootstrap, Version 12.4(12.2r)T, RELEASE SOFTWARE (fc1)
    7200Gateway uptime is 2 weeks, 5 days, 19 hours, 43 minutes
    System returned to ROM by power-on
    System image file is "disk2:/c7200p-adventerprisek9-mz.124-24.T7.bin"
    This product contains cryptographic features and is subject to United
    States and local country laws governing import, export, transfer and
    use. Delivery of Cisco cryptographic products does not imply
    third-party authority to import, export, distribute or use encryption.
    Importers, exporters, distributors and users are responsible for
    compliance with U.S. and local country laws. By using this product you
    agree to comply with applicable laws and regulations. If you are unable
    to comply with U.S. and local laws, return this product immediately.
    A summary of U.S. laws governing Cisco cryptographic products may be found at:
    http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
    If you require further assistance please contact us by sending email to
    [email protected].
    Cisco 7206VXR (NPE-G2) processor (revision A) with 1966080K/65536K bytes of memory.
    Processor board ID 13252317
    MPC7448 CPU at 1666Mhz, Implementation 0, Rev 2.2
    6 slot VXR midplane, Version 2.0
    Last reset from power-on
    PCI bus mb1 (Slots 1, 3 and 5) has a capacity of 600 bandwidth points.
    Current configuration on bus mb1 has a total of 0 bandwidth points.
    This configuration is within the PCI bus capacity and is supported.
    PCI bus mb2 (Slots 2, 4 and 6) has a capacity of 600 bandwidth points.
    Current configuration on bus mb2 has a total of 0 bandwidth points.
    This configuration is within the PCI bus capacity and is supported.
    Please refer to the following document "Cisco 7200 Series Port Adaptor
    Hardware Configuration Guidelines" on Cisco.com <http://www.cisco.com>
    for c7200 bandwidth points oversubscription and usage guidelines.
    1 FastEthernet interface
    3 Gigabit Ethernet interfaces
    2045K bytes of NVRAM.
    250880K bytes of ATA PCMCIA card at slot 2 (Sector size 512 bytes).
    65536K bytes of Flash internal SIMM (Sector size 512K).
    Configuration register is 0x2102
    ==============================================================
    7200Gateway#sh processes cpu
    CPU utilization for five seconds: 85%/84%; one minute: 84%; five minutes: 84%
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
       1          32         416         76  0.00%  0.00%  0.00%   0 Chunk Manager   
       2       32788      342520         95  0.00%  0.05%  0.05%   0 Load Meter      
       3           0           1          0  0.00%  0.00%  0.00%   0 chkpt message ha
       4           0           1          0  0.00%  0.00%  0.00%   0 EDDRI_MAIN      
       5     2624584      213262      12306  0.00%  0.03%  0.04%   0 Check heaps     
       6          56         373        150  0.00%  0.00%  0.00%   0 Pool Manager    
       7           0           2          0  0.00%  0.00%  0.00%   0 Timers          
       8           0           2          0  0.00%  0.00%  0.00%   0 ATM AutoVC Perio
       9           0           2          0  0.00%  0.00%  0.00%   0 ATM VC Auto Crea
      10          16       28543          0  0.00%  0.00%  0.00%   0 IPC Dynamic Cach
      11           0           1          0  0.00%  0.00%  0.00%   0 IPC Zone Manager
      12         688     1670887          0  0.00%  0.00%  0.00%   0 IPC Periodic Tim
      13         520     1670887          0  0.00%  0.00%  0.00%   0 IPC Deferred Por
      14           0           1          0  0.00%  0.00%  0.00%   0 IPC Seat Manager
      15           0           1          0  0.00%  0.00%  0.00%   0 IPC BackPressure
      16     9007072    30711869        293  1.35%  0.15%  0.11%   0 EnvMon          
      17           0           1          0  0.00%  0.00%  0.00%   0 OIR Handler     
      18           0           1          0  0.00%  0.00%  0.00%   0 Crash writer    
      19        1380        3892        354  0.00%  0.00%  0.00%   0 ARP Input       
      20        1584     1784473          0  0.00%  0.00%  0.00%   0 ARP Background  
      21           0           2          0  0.00%  0.00%  0.00%   0 ATM Idle Timer  
      22           0           1          0  0.00%  0.00%  0.00%   0 CEF MIB API     
      23           4         134         29  0.00%  0.00%  0.00%   0 AAA high-capacit
      24           0           1          0  0.00%  0.00%  0.00%   0 AAA_SERVER_DEADT
      25           0           1          0  0.00%  0.00%  0.00%   0 Policy Manager  
      26           0           2          0  0.00%  0.00%  0.00%   0 DDR Timers      
      27           0           5          0  0.00%  0.00%  0.00%   0 Entity MIB API  
      28           0           2          0  0.00%  0.00%  0.00%   0 Serial Backgroun
      29           0           1          0  0.00%  0.00%  0.00%   0 RO Notify Timers
      30           0           1          0  0.00%  0.00%  0.00%   0 RMI RM Notify Wa
      31          28         281         99  0.00%  0.00%  0.00%   0 EEM ED Syslog   
      32           0           2          0  0.00%  0.00%  0.00%   0 SMART           
      33         724     1712571          0  0.00%  0.00%  0.00%   0 GraphIt         
      34           0           2          0  0.00%  0.00%  0.00%   0 Dialer event    
      35           0           1          0  0.00%  0.00%  0.00%   0 SERIAL A'detect 
      36           0           2          0  0.00%  0.00%  0.00%   0 XML Proxy Client
      37           0           2          0  0.00%  0.00%  0.00%   0 VSA background  
      38           0           1          0  0.00%  0.00%  0.00%   0 VSA Cleanup Proc
      39           0           1          0  0.00%  0.00%  0.00%   0 Critical Bkgnd  
      40        4348      444483          9  0.00%  0.00%  0.00%   0 Net Background  
      41           0           2          0  0.00%  0.00%  0.00%   0 IDB Work        
      42          32         501         63  0.00%  0.00%  0.00%   0 Logger          
      43        1236     1710802          0  0.00%  0.00%  0.00%   0 TTY Background  
      44       16504     1712627          9  0.07%  0.00%  0.00%   0 Per-Second Jobs 
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
      45          20          34        588  0.00%  0.00%  0.00%   0 IF-MGR control p
      46           8          40        200  0.00%  0.00%  0.00%   0 IF-MGR event pro
      47           0           1          0  0.00%  0.00%  0.00%   0 Inode Table Dest
      48           0           1          0  0.00%  0.00%  0.00%   0 IKE HA Mgr      
      49           0           1          0  0.00%  0.00%  0.00%   0 IPSEC HA Mgr    
      50           4           4       1000  0.00%  0.00%  0.00%   0 rf task         
      51       12808      179149         71  0.00%  0.00%  0.00%   0 Net Input       
      52        1304      342532          3  0.00%  0.00%  0.00%   0 Compute load avg
      53      610136       28974      21058  0.00%  0.00%  0.00%   0 Per-minute Jobs 
      54           0           1          0  0.00%  0.00%  0.00%   0 Token Daemon    
      55           4       10570          0  0.00%  0.00%  0.00%   0 Transport Port A
      56        1272      505453          2  0.00%  0.00%  0.00%   0 HC Counter Timer
      57           0           1          0  0.00%  0.00%  0.00%   0 Coproc Event Pro
      58           0           1          0  0.00%  0.00%  0.00%   0 POS APS Event Pr
      59           0           1          0  0.00%  0.00%  0.00%   0 SONET alarm time
      60           0           1          0  0.00%  0.00%  0.00%   0 CSP Timer       
      61         204           4      51000  0.00%  0.00%  0.00%   0 USB Startup     
      62           0           2          0  0.00%  0.00%  0.00%   0 FPD Management P
      63           0           1          0  0.00%  0.00%  0.00%   0 FPD Action Proce
      64           0           2          0  0.00%  0.00%  0.00%   0 VNM DSPRM MAIN  
      65           0           1          0  0.00%  0.00%  0.00%   0 RF_INTERDEV_DELA
      66           0           1          0  0.00%  0.00%  0.00%   0 RF_INTERDEV_SCTP
      67         464     1712577          0  0.00%  0.00%  0.00%   0 ISA Common Helpe
      68           0           2          0  0.00%  0.00%  0.00%   0 Flash MIB Update
      69           0          58          0  0.00%  0.00%  0.00%   0 Flash Card Oir  
      70           0           1          0  0.00%  0.00%  0.00%   0 CES Line Conditi
      71           0           1          0  0.00%  0.00%  0.00%   0 CF_INTERDEV_SCTP
      72           0           1          0  0.00%  0.00%  0.00%   0 Async write proc
      73           0           2          0  0.00%  0.00%  0.00%   0 Ethernet CFM    
      74         736     1670893          0  0.00%  0.00%  0.00%   0 Ethernet Timer C
      75           0           1          0  0.00%  0.00%  0.00%   0 delayed evt hand
      76          28         112        250  0.00%  0.00%  0.00%   0 AAA Server      
      77           0           1          0  0.00%  0.00%  0.00%   0 AAA ACCT Proc   
      78           0           1          0  0.00%  0.00%  0.00%   0 ACCT Periodic Pr
      79           0           2          0  0.00%  0.00%  0.00%   0 AAA Dictionary R
      80         744     1670882          0  0.00%  0.00%  0.00%   0 BGP Scheduler   
      81           0           2          0  0.00%  0.00%  0.00%   0 Ethernet OAM Pro
      82           0           2          0  0.00%  0.00%  0.00%   0 Ethernet LMI    
      83           0           2          0  0.00%  0.00%  0.00%   0 CEF switching ba
      84        3684       14726        250  0.00%  0.00%  0.00%   0 ADJ resolve proc
      85           8          30        266  0.00%  0.00%  0.00%   0 IP ARP Adjacency
      86           0           1          0  0.00%  0.00%  0.00%   0 IP ARP Retry Age
      87     3481296     6804010        511  0.00%  0.02%  0.01%   0 IP Input        
      88           0           1          0  0.00%  0.00%  0.00%   0 ICMP event handl
      89           0           9          0  0.00%  0.00%  0.00%   0 TurboACL        
      90           0           2          0  0.00%  0.00%  0.00%   0 TurboACL chunk  
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
      91           0           1          0  0.00%  0.00%  0.00%   0 IPv6 Echo event 
      92          16        2854          5  0.00%  0.00%  0.00%   0 MOP Protocols   
      93           0           1          0  0.00%  0.00%  0.00%   0 LSP Tunnel FRR  
      94           0           1          0  0.00%  0.00%  0.00%   0 MPLS Auto-Tunnel
      95           0           3          0  0.00%  0.00%  0.00%   0 PPP Hooks       
      96           0           1          0  0.00%  0.00%  0.00%   0 Async write proc
      97           0           1          0  0.00%  0.00%  0.00%   0 SSS Manager     
      98           0           1          0  0.00%  0.00%  0.00%   0 SSS Feature Mana
      99           0           1          0  0.00%  0.00%  0.00%   0 SSS Feature Time
    100           0           2          0  0.00%  0.00%  0.00%   0 Spanning Tree   
    101           0           1          0  0.00%  0.00%  0.00%   0 X.25 Encaps Mana
    102          20          96        208  0.00%  0.00%  0.00%   0 SSM connection m
    103           0           1          0  0.00%  0.00%  0.00%   0 AC Switch       
    104           4        5709          0  0.00%  0.00%  0.00%   0 Authentication P
    105           0           1          0  0.00%  0.00%  0.00%   0 Auth-proxy AAA B
    106           0           2          0  0.00%  0.00%  0.00%   0 EAPoUDP Process 
    107           0           2          0  0.00%  0.00%  0.00%   0 IP Host Track Pr
    108           0           2          0  0.00%  0.00%  0.00%   0 KRB5 AAA        
    109        1152       49386         23  0.00%  0.00%  0.00%   0 IP Background   
    110        2276       28582         79  0.00%  0.00%  0.00%   0 IP RIB Update   
    111          60       34442          1  0.00%  0.00%  0.00%   0 CEF background p
    112        6784     2485297          2  0.00%  0.00%  0.00%   0 CEF: IPv4 proces
    113          12         104        115  0.00%  0.00%  0.00%   0 ADJ background  
    114           0           2          0  0.00%  0.00%  0.00%   0 PPP IP Route    
    115           0           2          0  0.00%  0.00%  0.00%   0 PPP IPCP        
    116           0           1          0  0.00%  0.00%  0.00%   0 IP Traceroute   
    117        7292     7550370          0  0.00%  0.00%  0.00%   0 TCP Timer       
    118        1300       10511        123  0.00%  0.00%  0.00%   0 TCP Protocols   
    119           0           1          0  0.00%  0.00%  0.00%   0 Socket Timers   
    120       18228       11429       1594  0.00%  0.00%  0.00%   0 HTTP CORE       
    121           0           2          0  0.00%  0.00%  0.00%   0 RLM groups Proce
    122           0           1          0  0.00%  0.00%  0.00%   0 L2X Data Daemon 
    123           0           1          0  0.00%  0.00%  0.00%   0 ac_atm_state_eve
    124           0           2          0  0.00%  0.00%  0.00%   0 SNMP Timers     
    125        1320     1710737          0  0.00%  0.00%  0.00%   0 RUDPV1 Main Proc
    126           0           1          0  0.00%  0.00%  0.00%   0 bsm_timers      
    127         568     1710728          0  0.00%  0.00%  0.00%   0 bsm_xmt_proc    
    128           0           1          0  0.00%  0.00%  0.00%   0 COPS            
    129           0           2          0  0.00%  0.00%  0.00%   0 Dialer Forwarder
    130           0           3          0  0.00%  0.00%  0.00%   0 Flow Exporter Ti
    131           0           2          0  0.00%  0.00%  0.00%   0 ATM OAM Input   
    132           0           2          0  0.00%  0.00%  0.00%   0 ATM OAM TIMER   
    133           0           1          0  0.00%  0.00%  0.00%   0 RARP Input      
    134           0           1          0  0.00%  0.00%  0.00%   0 IPv6 Inspect Tim
    135           0           1          0  0.00%  0.00%  0.00%   0 LAPB Process    
    136           0           2          0  0.00%  0.00%  0.00%   0 LFDp Input Proc 
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
    137           0           1          0  0.00%  0.00%  0.00%   0 PAD InCall      
    138           0           2          0  0.00%  0.00%  0.00%   0 X.25 Background 
    139           0           2          0  0.00%  0.00%  0.00%   0 PPP Bind        
    140           0           2          0  0.00%  0.00%  0.00%   0 PPP SSS         
    141           0           1          0  0.00%  0.00%  0.00%   0 MQC Flow Event B
    142       35504   424737438          0  0.23%  0.25%  0.23%   0 HQF Shaper Backg
    143        4068    17031478          0  0.00%  0.00%  0.00%   0 RBSCP Background
    144           0           2          0  0.00%  0.00%  0.00%   0 SCTP Main Proces
    145           0           1          0  0.00%  0.00%  0.00%   0 VPDN call manage
    146           0           1          0  0.00%  0.00%  0.00%   0 CHKPT EXAMPLE   
    147           0           1          0  0.00%  0.00%  0.00%   0 CHKPT DevTest   
    148           0           1          0  0.00%  0.00%  0.00%   0 IPS Process     
    149           0           2          0  0.00%  0.00%  0.00%   0 IPS Auto Update 
    150           0           2          0  0.00%  0.00%  0.00%   0 SDEE Management 
    151         948     3338807          0  0.00%  0.00%  0.00%   0 Inspect process 
    152           0           1          0  0.00%  0.00%  0.00%   0 xcpa-driver     
    153          52      136947          0  0.00%  0.00%  0.00%   0 FW DP Inspect pr
    154        1112     3338806          0  0.00%  0.00%  0.00%   0 CCE DP URLF cach
    155           0           2          0  0.00%  0.00%  0.00%   0 URL filter proc 
    156           0           1          0  0.00%  0.00%  0.00%   0 XSM_EVENT_ENGINE
    157         144      171238          0  0.00%  0.00%  0.00%   0 XSM_ENQUEUER    
    158          68      171238          0  0.00%  0.00%  0.00%   0 XSM Historian   
    159           0           1          0  0.00%  0.00%  0.00%   0 Select Timers   
    160           4           2       2000  0.00%  0.00%  0.00%   0 HTTP Process    
    161           0           2          0  0.00%  0.00%  0.00%   0 CIFS API Process
    162           0           2          0  0.00%  0.00%  0.00%   0 CIFS Proxy Proce
    163           0           1          0  0.00%  0.00%  0.00%   0 Crypto HW Proc  
    164          56      114166          0  0.00%  0.00%  0.00%   0 ACE policy loade
    165         156       68505          2  0.00%  0.00%  0.00%   0 CRM_CALL_UPDATE_
    166       36688      172862        212  0.00%  0.00%  0.00%   0 BGP I/O         
    167           0           2          0  0.00%  0.00%  0.00%   0 AAA Cached Serve
    168           0           2          0  0.00%  0.00%  0.00%   0 ENABLE AAA      
    169           0           1          0  0.00%  0.00%  0.00%   0 EM Background Pr
    170           0           1          0  0.00%  0.00%  0.00%   0 Key chain liveke
    171           0           2          0  0.00%  0.00%  0.00%   0 LINE AAA        
    172          44         112        392  0.00%  0.00%  0.00%   0 LOCAL AAA       
    173           0          42          0  0.00%  0.00%  0.00%   0 MPLS Auto Mesh P
    174           0           2          0  0.00%  0.00%  0.00%   0 TPLUS           
    175           0           2          0  0.00%  0.00%  0.00%   0 VSP_MGR         
    176           0           1          0  0.00%  0.00%  0.00%   0 FW_TEST_TRP     
    177           0           1          0  0.00%  0.00%  0.00%   0 EPM MAIN PROCESS
    178           4           3       1333  0.00%  0.00%  0.00%   0 Crypto WUI      
    179           0           2          0  0.00%  0.00%  0.00%   0 Crypto Support  
    180           0           1          0  0.00%  0.00%  0.00%   0 IPSECv6 PS Proc 
    181           0           1          0  0.00%  0.00%  0.00%   0 CCVPM_HTSP      
    182           0           1          0  0.00%  0.00%  0.00%   0 CCVPM_R2        
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
    183           0           1          0  0.00%  0.00%  0.00%   0 EPHONE MWI Refre
    184           0        1903          0  0.00%  0.00%  0.00%   0 FB/KS Log HouseK
    185           0           2          0  0.00%  0.00%  0.00%   0 EPHONE MWI BG Pr
    186           0           1          0  0.00%  0.00%  0.00%   0 Skinny HW confer
    187           0           1          0  0.00%  0.00%  0.00%   0 CCSWVOICE       
    188      206492      114180       1808  0.00%  0.00%  0.00%   0 BGP Scanner     
    189           0           1          0  0.00%  0.00%  0.00%   0 http client proc
    190           0           3          0  0.00%  0.00%  0.00%   0 BGP Event       
    191           0           1          0  0.00%  0.00%  0.00%   0 QOS_MODULE_MAIN 
    192           0           1          0  0.00%  0.00%  0.00%   0 RPMS_PROC_MAIN  
    193           0           1          0  0.00%  0.00%  0.00%   0 VoIP AAA        
    194           0           2          0  0.00%  0.00%  0.00%   0 Dialog Manager  
    195         184         104       1769  0.00%  0.00%  0.00%   0 crypto engine pr
    196           0           4          0  0.00%  0.00%  0.00%   0 Crypto CA       
    197           0           1          0  0.00%  0.00%  0.00%   0 Crypto PKI-CRL  
    198       28008       64288        435  0.00%  0.00%  0.00%   0 encrypt proc    
    199      384768       28300      13596  0.00%  0.00%  0.00%   0 crypto sw pk pro
    200           8          27        296  0.00%  0.00%  0.00%   0 Crypto INT      
    201         456        2019        225  0.00%  0.00%  0.00%   0 Crypto IKE Dispa
    202        2128        2714        784  0.00%  0.00%  0.00%   0 Crypto IKMP     
    203           0           1          0  0.00%  0.00%  0.00%   0 IPSEC manual key
    204         180       85737          2  0.00%  0.00%  0.00%   0 IPSEC key engine
    205           0           1          0  0.00%  0.00%  0.00%   0 CRYPTO QoS proce
    206          28         142        197  0.00%  0.00%  0.00%   0 Crypto ACL      
    207           0           1          0  0.00%  0.00%  0.00%   0 Crypto PAS Proc 
    208           0           1          0  0.00%  0.00%  0.00%   0 GDOI GM Process 
    209           0           1          0  0.00%  0.00%  0.00%   0 UNICAST REKEY   
    210           0           1          0  0.00%  0.00%  0.00%   0 UNICAST REKEY AC
    211           0           1          0  0.00%  0.00%  0.00%   0 MV64 TDR Process
    212           0           1          0  0.00%  0.00%  0.00%   0 IMA Traps       
    213           0           1          0  0.00%  0.00%  0.00%   0 SYSMGT Events   
    214           0           2          0  0.00%  0.00%  0.00%   0 Control-plane ho
    215           0           1          0  0.00%  0.00%  0.00%   0 DATA Transfer Pr
    216           0           1          0  0.00%  0.00%  0.00%   0 DATA Collector  
    217           0           1          0  0.00%  0.00%  0.00%   0 Async write proc
    218         116         292        397  0.00%  0.00%  0.00%   0 AAA SEND STOP EV
    219         136      171243          0  0.00%  0.00%  0.00%   0 RMON Recycle Pro
    220           0           2          0  0.00%  0.00%  0.00%   0 RMON Deferred Se
    221           0           1          0  0.00%  0.00%  0.00%   0 Syslog Traps    
    222           0           2          0  0.00%  0.00%  0.00%   0 EEM ED Resource 
    223           0           2          0  0.00%  0.00%  0.00%   0 EEM ED Routing  
    224           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Track    
    225          80       53575          1  0.00%  0.00%  0.00%   0 Crypto cTCP proc
    226           0           1          0  0.00%  0.00%  0.00%   0 IP SLAs Ethernet
    227           4           1       4000  0.00%  0.00%  0.00%   0 RMON Packets    
    228         820     1709984          0  0.00%  0.00%  0.00%   0 trunk conditioni
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
    229           0           1          0  0.00%  0.00%  0.00%   0 trunk conditioni
    230          12         120        100  0.00%  0.00%  0.00%   0 EEM Server      
    231           4           2       2000  0.00%  0.00%  0.00%   0 Call Home proces
    232          52         260        200  0.00%  0.00%  0.00%   0 Syslog          
    233           0           1          0  0.00%  0.00%  0.00%   0 VPDN Test       
    234           0           2          0  0.00%  0.00%  0.00%   0 EEM Policy Direc
    235           0           2          0  0.00%  0.00%  0.00%   0 EEM ED CLI      
    236           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Counter  
    237           0           3          0  0.00%  0.00%  0.00%   0 EM ED GOLD      
    238           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Interface
    239           0           3          0  0.00%  0.00%  0.00%   0 EEM ED IOSWD    
    240           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Ipsla    
    241           0           3          0  0.00%  0.00%  0.00%   0 EEM ED None     
    242           0           2          0  0.00%  0.00%  0.00%   0 EEM ED Nf       
    243           0           3          0  0.00%  0.00%  0.00%   0 EEM ED OIR      
    244           0           3          0  0.00%  0.00%  0.00%   0 EEM ED RF       
    245           0           3          0  0.00%  0.00%  0.00%   0 EEM ED SNMP     
    246           0           2          0  0.00%  0.00%  0.00%   0 EEM ED SNMP Noti
    247          36       42890          0  0.00%  0.00%  0.00%   0 EEM ED Timer    
    248           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Test     
    249           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Config   
    250           0           3          0  0.00%  0.00%  0.00%   0 EEM ED Env      
    251           0           3          0  0.00%  0.00%  0.00%   0 EEM ED RPC      
    252           0           2          0  0.00%  0.00%  0.00%   0 cpf_process_msg_
    253           0           1          0  0.00%  0.00%  0.00%   0 Key Proc        
    254          36       28543          1  0.00%  0.00%  0.00%   0 Call Home Timer 
    255           0           1          0  0.00%  0.00%  0.00%   0 tHUB            
    256           0           1          0  0.00%  0.00%  0.00%   0 Async write proc
    257         104         953        109  0.00%  0.00%  0.00%   0 SSH Event handle
    258          16       28543          0  0.00%  0.00%  0.00%   0 Secure Login    
    259          84          54       1555  0.00%  0.00%  0.00%   0 Tunnel Security 
    260          56          67        835  0.00%  0.00%  0.00%   0 Crypto SS Proces
    261           0           1          0  0.00%  0.00%  0.00%   0 cpf_process_tpQ 
    262           0           1          0  0.00%  0.00%  0.00%   0 TCP Listener    
    263           0           2          0  0.00%  0.00%  0.00%   0 IP Flow Top Talk
    264        1180     3338804          0  0.00%  0.00%  0.00%   0 IP NAT Ager     
    265           0           1          0  0.00%  0.00%  0.00%   0 IP NAT WLAN     
    266          24       28563          0  0.00%  0.00%  0.00%   0 IP SLAs Event Pr
    267      434504     1489526        291  0.00%  0.00%  0.00%   0 IP SNMP         
    268      170304      877961        193  0.00%  0.00%  0.00%   0 PDU DISPATCHER  
    269      495704      877992        564  0.00%  0.00%  0.00%   0 SNMP ENGINE     
    270           0           2          0  0.00%  0.00%  0.00%   0 IP SNMPV6       
    271           0           1          0  0.00%  0.00%  0.00%   0 SNMP ConfCopyPro
    272           0           1          0  0.00%  0.00%  0.00%   0 SNMP Traps      
    273     1185420     1715196        691  0.00%  0.00%  0.00%   0 NTP             
    274         412          29      14206  0.00%  0.00%  0.00%   0 VTEMPLATE Backgr
    PID Runtime(ms)     Invoked      uSecs   5Sec   1Min   5Min TTY Process
    275       18608      174262        106  0.00%  0.00%  0.00%   0 BGP Router      
    276          36       27171          1  0.00%  0.00%  0.00%   0 DFS flush period
    277           8          12        666  0.00%  0.00%  0.00%   0 Collection proce
    278          16         651         24  0.00%  0.00%  0.00%   0 CRYPTO IKMP IPC 
    279        1724         850       2028  0.00%  0.00%  0.00%   2 SSH Process     
    281           0           1          0  0.00%  0.00%  0.00%   0 Skinny MOH Event
    282          64      173856          0  0.00%  0.00%  0.00%   0 Skinny Socket Se
    283           0        1451          0  0.00%  0.00%  0.00%   0 Web Write Housek
    ==============================================================
    wish to help ASAP

    JosephDoherty wrote:DisclaimerThe   Author of this posting offers the information contained within this   posting without consideration and with the reader's understanding that   there's no implied or expressed suitability or fitness for any purpose.   Information provided is for informational purposes only and should not   be construed as rendering professional advice of any kind. Usage of  this  posting's information is solely at reader's own risk.Liability DisclaimerIn   no event shall Author be liable for any damages whatsoever (including,   without limitation, damages for loss of use, data or profit) arising  out  of the use or inability to use the posting's information even if  Author  has been advised of the possibility of such damage.PostingThe fact you are matching with any ACLs, will decrease maximum performance.The fact you are using a policy-may, will decrease maximum performance.The fact is a -G2 only has finite capacity.In other words, what you're seeing might be completely normal for your traffic volume, your traffic composition and your configuration.If you believe your router is overloaded, and generally above 75% CPU might be so considered, either you'll need a faster device (see ASR 1Ks), or you might try changing your configuration to decrease your configuration load on the router.What's your CPU load if your remove the policy-map from the interface?If removing the policy-map from the interface shows a significant CPU loading decrease - QED.If you need/desire such QoS, then you'll want a "faster" router.You might be also able to decrease your CPU a little by some "tuning".  I already mention the TurboACL feature statement.  With ACLs, fewer are faster, and how they ordered (especially without TurboACL) impacts CPU.  How you order you class-maps, within a policy, and how the match statements are ordered will also have some impact on the CPU load.  If buffers are being allocated/deallocated, that too will impact CPU loading.  I assume CEF is enabled, but for some traffic, flow caching might decrease CPU load.Remember a software based router, like the 7200s, are, more or less, a computer that takes your configuration and determines what's to be done with every packet it "sees".  The more your configuration requires for per packet analysis, the more load for each packet.There are whitepapers addressing high CPU load caused by "process switching", but what you posted appears to be mostly all interrupt processing, which is "fast path", or optimal, packet forwarding.  There's not much you can normally do to improve against that, other than insuring your configuration is as optimal as possible for your needs (again, things like sequencing/ordering of statements).
    hi ,
    thanks very very much for this nice information,
    let me answer you :
    you said that NPE G2 has finite capacity , but how to know this full capacity ???
    i mean that my policy map is matching the traffic , but the matched traffic is not being enhancemend ??!!!
    last about two weeks , the matched traffic of youtube was excellent and no interrupt durting the my rush hour.
    i didnt change any thing, but my bw increased from 730 Mbps to 760Mbps ,
    im un able to make sure that i need to chnage my platform to faster one.
    agian
    my cpu is 60 % without QOS
    after QOS it increase to 80-85 %
    agian ,
    about NBAR
    i want to tell you that i cant depend on NBAR , as an example , im matching the ips of videos of facebook , i cant depend on NBAR because it is https videos.
    but in summary ,
    my qos is matching well , but i have no real enhancement for my traffic.
    did you face my issue before  ???
    i mean have you see like my problem ?
    like my router platform  with cpu over 80 % and 750Mbps , and matched qos without good result ??
    note that i upgraded to iso 15 , but seems same issue !!!
    regards

  • REPORT TAKING MORE CPU UTILIZATION

    Hello Experts,
    my following report is of sales order report it gives me an output in less than 250 seconds,
    But taking 80 percentage CPU time so tell me how to overcome this problem ??
    <b>&----
    *& Report  ZMSL_SALES_ORDER_REPORT
    REPORT  ZMSL_SALES_ORDER_REPORT.
    DEFINE: M_FIELDCAT.
      ADD 1 TO LS_FIELDCAT-COL_POS.
      LS_FIELDCAT-FIELDNAME = &1.
      LS_FIELDCAT-SELTEXT_L = &2.
      LS_FIELDCAT-OUTPUTLEN = &3.
      LS_FIELDCAT-TABNAME = 'gt_final_data'.
      APPEND LS_FIELDCAT TO FELD_CAT.
    END-OF-DEFINITION.
    *==================Start of Datebase tables Declaration=================
    TABLES : VBAK, "Sales Document: Header Data
             VBAP, "Sales Document: Item Data
             MARA, "Matrial Master
             VBEP, "Sales Document: Schedule Line Data
             VBPA, "Sales Document: Partner
             TVROT,
             YMSLT_MAIL_ID.
    *=================End of Datebase tables Declaration====================
    *==================Start of Virable  ALV  declaration=================
    **=============================
    TYPE POOLS
    *=============================
    TYPE-POOLS: SLIS.
    *=============================
    *FIELD CATALOG DECLARATION
    *=============================
    CONSTANTS : CO_FORMNAME_TOP_OF_PAGE  TYPE SLIS_FORMNAME
                                         VALUE 'TOP_OF_PAGE'.
    DATA : G_TABNAME_HEADER TYPE SLIS_TABNAME,
           G_TABNAME_ITEM   TYPE SLIS_TABNAME.
    DATA:  FELD_CAT TYPE SLIS_T_FIELDCAT_ALV," WITH HEADER LINE ,
           ALV_LAYOUT   TYPE SLIS_LAYOUT_ALV,
           T_EVENTS           TYPE SLIS_T_EVENT,
           G_SAVE(1) TYPE C,
           G_VARIANT LIKE DISVARIANT,
           GX_VARIANT LIKE DISVARIANT,
           EVENTS   TYPE SLIS_T_EVENT,
           G_EXIT(1) TYPE C,
           LAYOUT   TYPE SLIS_LAYOUT_ALV,
           ALV_PRINT        TYPE SLIS_PRINT_ALV,
           ALV_DETAIL_FUNC(30),
          EVENTS   TYPE SLIS_T_EVENT,
           T_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    RANGES : R_PARVW FOR VBPA-PARVW.
    *=================End of Virable  tables Declaration====================
    *==================Start of Selection Screen Declaration================
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN BEGIN OF BLOCK VAR WITH FRAME TITLE VARIANT.
    PARAMETERS     : P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK VAR.
    SELECTION-SCREEN :BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS : S_VKORG FOR VBAK-VKORG OBLIGATORY, " Sales Org.
                     S_VKBUR FOR VBAK-VKBUR, " Sales Office
                     S_VKGRP FOR VBAK-VKGRP, " Sales Group
                     S_VTWEG FOR VBAK-VTWEG. " Distribution Channel
    SELECTION-SCREEN :END OF BLOCK B2.
    SELECTION-SCREEN :BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
    SELECT-OPTIONS : S_KUNNR FOR VBAK-KUNNR, "Customer Number
                     S_VBELN FOR VBAK-VBELN, "Sales Order Number
                     S_ERDAT FOR VBAK-ERDAT, "OBLIGATORY, "Sales Order Date
                     S_AUGRU FOR VBAK-AUGRU, "Order Reason
                     S_BSTNK FOR VBAK-BSTNK, "PO Number
                     S_AUART FOR VBAK-AUART. "Sales order type
    SELECTION-SCREEN :END OF BLOCK B3.
    SELECTION-SCREEN :BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-004.
    SELECT-OPTIONS : S_WERKS FOR VBAP-WERKS,  "plant,
                     S_MATNR FOR VBAP-MATNR, " Matrial Code
                     S_PSTYV FOR VBAP-PSTYV, "Sales Order Item cat.
                     S_EDATU FOR VBEP-EDATU,  "Conformatin Date
                     S_REQDAT FOR VBAP-ZZCUST_REQDAT. "Req.Del Date
    SELECTION-SCREEN :END OF BLOCK B4.
    SELECTION-SCREEN :BEGIN OF BLOCK B5 WITH FRAME TITLE TEXT-005.
    SELECT-OPTIONS : S_ZE FOR  VBPA-KUNNR NO INTERVALS NO-EXTENSION , "Partner Function
                     S_ZS FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
                     S_ZA FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
                     S_ZR FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
                     S_ZI FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION. "Partner Function
    *FOR VBPA-KUNNR MATCHCODE OBJECT ZSMR ,
    ***SELECT-OPTIONS : S_ZE FOR  VBPA-PARVW NO INTERVALS NO-EXTENSION , "Partner Function
                    S_ZS FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
                    S_ZA FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
                    S_ZR FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
                    S_ZI FOR VBPA-PARVW NO INTERVALS NO-EXTENSION. "Partner Function
    SELECTION-SCREEN :END OF BLOCK B5.
    SELECTION-SCREEN : BEGIN OF BLOCK B6 WITH FRAME TITLE TEXT-006.
    PARAMETER :  P_SCREEN RADIOBUTTON GROUP RTYP DEFAULT 'X' USER-COMMAND
                                                     UCOMM ,
                 P_FILE  RADIOBUTTON GROUP RTYP,
                 P_MAIL  RADIOBUTTON GROUP RTYP.
    SELECTION-SCREEN :END OF BLOCK B6.
    SELECTION-SCREEN : BEGIN OF BLOCK B7 WITH FRAME TITLE TEXT-007.
    PARAMETER :  P_PEN RADIOBUTTON GROUP RE1 DEFAULT 'X' USER-COMMAND
                                                     UCOMM , " Pending Sales order
                 P_ALL  RADIOBUTTON GROUP RE1,  " ALL Sales order
                 P_BLOCK  RADIOBUTTON GROUP RE1.  " Blocked Sales order
                P_DELE   RADIOBUTTON GROUP RE1.  " Delevered Sales order
    SELECTION-SCREEN :END OF BLOCK B7.
    SELECTION-SCREEN : END OF BLOCK B1.
    *=================End of Selection Screen Declaration===================
    *==================Start of Internal table Declaration==================
    Internal table for vbak
    DATA : BEGIN OF GT_VBAK OCCURS 0 ,
                VBELN             LIKE VBAK-VBELN , " Sales Document Number
                ERDAT             LIKE VBAK-ERDAT , " Order Date
                AUART             LIKE VBAK-AUART,  "Sales Document Type
                VTWEG             LIKE VBAK-VTWEG,  "Distribution Channel
                SPART             LIKE VBAK-SPART,  "Division
                KNUMV             LIKE VBAK-KNUMV ,  "Number of the document condition
                BSTNK             LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
                BSTDK             LIKE VBAK-BSTDK,  "Customer purchase order date
                KUNNR             LIKE VBAK-KUNNR,  " Customer Code
                ZOA_RECP_PLAN_DT  LIKE VBAK-ZOA_RECP_PLAN_DT, "Order receipt at plant
           END OF GT_VBAK.
    Internal table for VBAP
    DATA : BEGIN OF GT_VBAP OCCURS 0,
              VBELN LIKE VBAP-VBELN, " Sales Document Number
              POSNR LIKE VBAP-POSNR, " Sales Doc. Line item number
              MATNR LIKE VBAP-MATNR,
              ABGRU LIKE VBAP-ABGRU, "Reason for rejection
              MEINS LIKE VBAP-MEINS,  "Base Unit of Measure
              FAKSP LIKE VBAP-FAKSP,
              NETWR  LIKE VBAP-NETWR, " Net Value
              KWMENG LIKE VBAP-KWMENG, " Order Quantity
              WERKS LIKE VBAP-WERKS, "PLANT
              LGORT LIKE VBAP-LGORT, "S.Loc
              ROUTE LIKE VBAP-ROUTE, " Route
              ZZWIDTH LIKE VBAP-ZZWIDTH, " widht
              ZZKDMAT LIKE VBAP-ZZKDMAT, " customer Matrial
              ZZBRAND LIKE VBAP-ZZBRAND, " bRAND
              ZZSPLDIA LIKE VBAP-ZZSPLDIA, "Spool Diameter
              ZZCUST_REQDAT LIKE VBAP-ZZCUST_REQDAT, " REquested Date
              ZZCOATING LIKE VBAP-ZZCOATING,
              ZZWEIGHT LIKE VBAP-ZZWEIGHT,
              ZZWEIGHT_UMO LIKE VBAP-ZZWEIGHT_UMO,
             END OF GT_VBAP.
    Internal table for VBEP
    DATA : BEGIN OF GT_VBEP OCCURS 0,
              VBELN LIKE VBEP-VBELN, " Sales Doc. Number
              POSNR LIKE VBEP-POSNR, " Sales Doc. Item Number
              ETENR LIKE VBEP-ETENR, "Delivery Schedule Line Number
              EDATU LIKE VBEP-EDATU, "Schedule line date
             END OF GT_VBEP.
    Internal table for VBPA
    DATA : BEGIN OF GT_VBPA OCCURS 0,
             VBELN LIKE VBAP-VBELN, "Sales Document Number
             POSNR LIKE VBAP-POSNR, "Sales Document Item Number
             PARVW LIKE VBPA-PARVW, "Partner Function
             KUNNR LIKE VBPA-KUNNR, " Customer Number
          END OF GT_VBPA.
    Internal table for VBKD
    DATA : BEGIN OF GT_VBKD OCCURS 0,
            VBELN LIKE VBKD-VBELN , " Sales Documet number
            KDGRP LIKE VBKD-KDGRP, " Custoemr Group
            INCO1 LIKE VBKD-INCO1, "Incoterms (Part 1)
            INCO2 LIKE VBKD-INCO2, "Incoterms (Part 2)
            ZTERM LIKE VBKD-ZTERM, " Payment Term
            STCUR LIKE VBKD-STCUR, " Exchang Rate
         END OF GT_VBKD.
    Internal table VBFA
    DATA : BEGIN OF GT_VBFA OCCURS 0 ,
             VBELV   LIKE VBFA-VBELV, " Preceding sales and distribution document
             POSNV   LIKE VBFA-POSNV, "Preceding item of an SD document
             VBELN   LIKE VBFA-VBELN, "Subsequent sales and distribution document
             POSNN   LIKE VBFA-POSNN, "Subsequent item of an SD document
             VBTYP_N LIKE VBFA-VBTYP_N, "Document category of subsequent document
             RFMNG   LIKE VBFA-RFMNG,    "Referenced quantity in base unit of measure
           END OF GT_VBFA.
    Internal table for KONV
    DATA :  BEGIN OF GT_KONV OCCURS 0,
                  KNUMV LIKE KONV-KNUMV, "Number of the document condition
                  KPOSN LIKE KONV-KPOSN, "Condition item number
                  KSCHL LIKE KONV-KSCHL , "Cond Type.
                  KBETR LIKE KONV-KBETR, " Rate per KG
                  WAERS LIKE KONV-WAERS, "currency
                  KWERT LIKE KONV-KWERT, "Condition value
              END OF GT_KONV.
    Internal table for MSKA,
    DATA  : BEGIN OF GT_MSKA OCCURS 0,
               MATNR LIKE MSKA-MATNR, "Matrial
               WERKS LIKE MSKA-WERKS, "PLANT
               LGORT LIKE MSKA-LGORT, "S. Loc
               CHARG  LIKE MSKA-CHARG,"Batch Number
               SOBKZ LIKE MSKA-SOBKZ, "Special Stock Indicator
               VBELN LIKE MSKA-VBELN , "Sales Doc Number
               POSNR LIKE MSKA-POSNR, "Sales Doc Item Number
               KALAB LIKE MSKA-KALAB, "Unrestricted-Use Stock
               KAINS LIKE MSKA-KAINS, " Stock in Quality Inspection
            END OF GT_MSKA.
    Internal table for MARD
    DATA : BEGIN OF GT_MARD OCCURS 0 ,
              MATNR LIKE MARD-MATNR, "Matrial
              WERKS LIKE MARD-WERKS, "PLANT
              LGORT LIKE MARD-LGORT, "S. Loc
              LABST LIKE MARD-LABST, "Valuated Unrestricted-Use Stock
           END OF GT_MARD.
    Internal table for KNA1
    DATA : BEGIN OF GT_KNA1 OCCURS 0,
               KUNNR LIKE KNA1-KUNNR , " Customer Number
               NAME1 LIKE KNA1-NAME1,  "Customer Name
               NAME2 LIKE KNA1-NAME2,  " Customer Name
               ORT01 LIKE KNA1-ORT01, "City
            END OF GT_KNA1.
    DATA: BEGIN OF GT_KNA1_1 OCCURS 0,
              KUNNR LIKE KNA1-KUNNR , " Customer Number
              NAME1 LIKE KNA1-NAME1,  "Customer Name
             ORT01 LIKE KNA1-ORT01,
           END OF GT_KNA1_1.
    Internal table for KNVV
    DATA : BEGIN OF GT_KNVV OCCURS 0,
                KUNNR LIKE KNVV-KUNNR , " Customer Number
                KLABC LIKE KNVV-KLABC, " Custoemr Class
           END OF GT_KNVV.
    Internal table for MAKT,
    DATA : BEGIN OF GT_MAKT OCCURS 0,
             MATNR LIKE MAKT-MATNR,  "Matrial
             SPRAS LIKE MAKT-SPRAS,
             MAKTX LIKE MAKT-MAKTX, "Matrial DESC
             MAKTG LIKE MAKT-MAKTG,
          END OF GT_MAKT.
    Internal table for MVKE
    DATA : BEGIN OF GT_MVKE OCCURS 0 ,
                MATNR LIKE MVKE-MATNR,  "Matrial
                MVGR1 LIKE MVKE-MVGR1, " Matrial Group
          END OF GT_MVKE.
    Internal table for TVM1T
    DATA : BEGIN OF GT_TVM1T OCCURS 0 ,
                 SPRAS LIKE TVM1T-SPRAS,
                 MVGR1 LIKE TVM1T-MVGR1, " Matrial Group
                 BEZEI LIKE TVM1T-BEZEI, "  Matrial Group DESC
          END OF GT_TVM1T.
    Internal table for TSPAT
    DATA : BEGIN OF GT_TSPAT OCCURS 0,
                SPRAS LIKE TSPAT-SPRAS,
                SPART LIKE VBAK-SPART,  "Division
                VTEXT LIKE TSPAT-VTEXT, "Division Desc
           END OF GT_TSPAT.
    Internal table for TVTWT
    DATA : BEGIN OF GT_TVTWT OCCURS 0 ,
            SPRAS LIKE TVTWT-SPRAS,
            VTWEG LIKE VBAK-VTWEG, "  Distribution Channel
            VTEXT LIKE TVTWT-VTEXT, "Distribution Channel Desc
           END OF GT_TVTWT.
    Internal table for TVAKT
    DATA : BEGIN OF GT_TVAKT OCCURS 0,
              SPRAS LIKE TVAKT-SPRAS,
              AUART LIKE VBAK-AUART,  "Sales Document Type
              BEZEI LIKE TVAKT-BEZEI, "sALES dOC TYPE Description
           END OF GT_TVAKT .
    Internal table for T151t
    DATA: BEGIN OF GT_VBUP OCCURS 0,
              VBELN LIKE VBUP-VBELN,
              POSNR LIKE VBUP-POSNR,
              GBSTA LIKE VBUP-GBSTA,
          END OF GT_VBUP.
    DATA : BEGIN OF GT_T151T OCCURS 0,
              SPRAS LIKE T151T-SPRAS,
              KDGRP LIKE VBKD-KDGRP, " Custoemr Group
              KTEXT LIKE T151T-KTEXT, " Custoemr Group Desc
          END OF GT_T151T.
    DATA : BEGIN OF GT_TVROT OCCURS 0,
              SPRAS LIKE TVROT-SPRAS,
              ROUTE LIKE TVROT-ROUTE, " Route code
              BEZEI LIKE TVROT-BEZEI , " Route Desc
           END OF GT_TVROT.
    DATA : BEGIN OF GT_T052U OCCURS 0,
              SPRAS LIKE T052U-SPRAS,
              ZTERM LIKE T052U-ZTERM, " Payment terms
              TEXT1 LIKE T052U-TEXT1, " text
           END OF GT_T052U.
    DATA: BEGIN OF GT_VBUK OCCURS 0,
             VBELN LIKE VBUK-VBELN,
             WBSTK LIKE VBUK-WBSTK,
          END OF GT_VBUK.
    *-------fINAL iNTERNAL TABLE FOR OUTPUT
    DATA : BEGIN OF GT_FINAL_DATA OCCURS 0,
                KUNNR             LIKE VBAK-KUNNR, " cUSTOMER CODE
                NAME(70)          TYPE C, " cUSTOMER NAME
                ORT01             LIKE KNA1-ORT01, "cITY
                S_KUNNR           LIKE VBAK-KUNNR, " cUSTOMER CODE
                S_NAME(70)        TYPE C, " cUSTOMER NAME
                S_ORT01           LIKE KNA1-ORT01, "cITY
                KLABC             LIKE KNVV-KLABC, " Custoemr Class
                VBELN(70)         TYPE C, "   LIKE VBAK-VBELN, "sALES oRDER nUMBER
                POSNR             LIKE VBAP-POSNR, "SALES ORDER LINE NUMBER
                INCO1             LIKE VBKD-INCO1, "Incoterms (Part 1)
                INCO2             LIKE VBKD-INCO2, "Incoterms (Part 2)
                KALAB             LIKE MSKA-KALAB, "Unrestricted-Use Stock
                KAINS             LIKE MSKA-KAINS, " Stock in Quality Inspection
                LABST             LIKE MARD-LABST, "Valuated Unrestricted-Use Stock
                ERDAT             LIKE VBAK-ERDAT , " Order Date
                MATNR             LIKE MAKT-MATNR,  "Matrial
                MAKTX             LIKE MAKT-MAKTX, "Matrial DESC
                MAKTG             LIKE MAKT-MAKTG, "Matrial DESC
                ZZKDMAT           LIKE VBAP-ZZKDMAT, "Customter Mat. Number
                ABGRU             LIKE VBAP-ABGRU, " Reason for rejection
                COLOR(20)         TYPE C,          "Color
                COMPLEX(20)       TYPE C,         "Complex
                WIDTH(10)         TYPE C,          "Width
                KBETR             LIKE KONV-KBETR, " Rate per KG
                WAERS             LIKE KONV-WAERS, "currency
                STCUR             LIKE VBKD-STCUR, " Exchang Rate
                MEINS             LIKE VBAP-MEINS,  "Base Unit of Measure
                KWMENG            LIKE VBAP-KWMENG, " Order Quantity
                RFMNG             LIKE VBFA-RFMNG,    "Referenced quantity in base unit of measure
                BAL_QTY           LIKE VBFA-RFMNG, " Balance QTY
                EDATU             LIKE VBEP-EDATU, "Schedule line date
                DAYS(5)          TYPE C, " Sch.Delay
                BSTNK             LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
                BSTDK             LIKE VBAK-BSTDK,  "Customer purchase order date
                VTWEG             LIKE VBAK-VTWEG,  "Distribution Channel
                SPART             LIKE VBAK-SPART,  "Division
                DIST_NAME         LIKE TVTWT-VTEXT, "Distribution Channels NAME
                DIV_NAME          LIKE TSPAT-VTEXT, "Sales Divisions NAME
                ZA_KUNNR          LIKE KNA1-KUNNR,
                ZA_NAME               LIKE KNA1-NAME1,
                ZE_KUNNR          LIKE KNA1-KUNNR,
                ZE_NAME               LIKE KNA1-NAME1,
                ZI_KUNNR          LIKE KNA1-KUNNR,
                ZI_NAME               LIKE KNA1-NAME1,
                ZR_KUNNR          LIKE KNA1-KUNNR,
                ZR_NAME               LIKE KNA1-NAME1,
                ZS_KUNNR          LIKE KNA1-KUNNR,
                ZS_NAME               LIKE KNA1-NAME1,
                MVGR1(20)         TYPE C          , " Matrial Group
                B_VALUE           LIKE KONV-KWERT, "bASIC value
                EX_VALUE          LIKE KONV-KWERT, "eXCISE value
                EC_VALUE          LIKE KONV-KWERT, "ecess value
                HE_VALUE          LIKE  KONV-KWERT, "hcess value
                VAT_VALUE         LIKE KONV-KWERT, "VAT value
                CST_VALUE         LIKE KONV-KWERT, "CST
                F_VALUE           LIKE KONV-KWERT, "fREIGJT
                C_VALUE           LIKE KONV-KWERT, "cOMISSION
                KDGRP(70)         TYPE C, " Custoemr Group
                NETWR             LIKE VBAP-NETWR, " Net Value
                INR               LIKE VBAP-NETWR, " inr Net Value
                AUART             LIKE VBAK-AUART,  "Sales Document Type
                BEZEI             LIKE TVAKT-BEZEI, "SALES DOC TYPE DESC
                ZOA_RECP_PLAN_DT  LIKE VBAK-ZOA_RECP_PLAN_DT, "Order receipt at plant
                ZZCUST_REQDAT     LIKE VBAP-ZZCUST_REQDAT, " REquested Date
                ROUTE             LIKE VBAP-ROUTE, " Route
                ROUTE_NAME        LIKE  TVROT-BEZEI , "Route name
                ZZBRAND           LIKE VBAP-ZZBRAND, " bRAND
                ZZSPLDIA          LIKE VBAP-ZZSPLDIA, "Spool Diameter
                ZTERM             LIKE VBKD-ZTERM, " Payment Term
                Z_TERM_TEXT(50)   TYPE C, "Payment Terms Text
                Z001(50)          TYPE C, "text
                Z002(50)          TYPE C, "text
                Z003(50)          TYPE C, "text
                Z004(50)          TYPE C, "text
                ZI_001(50)        TYPE C, "text
                ZI_002(50)        TYPE C, "text
                ZZCOATING(20)     TYPE C,
                ZZWEIGHT          LIKE VBAP-ZZWEIGHT,
                ZZWEIGHT_UMO      LIKE VBAP-ZZWEIGHT_UMO,
                WBSTK             LIKE VBUK-WBSTK,
                T_NETWR           LIKE VBAP-NETWR, " Net Value
                FAKSP             LIKE VBAP-FAKSP,
           END OF GT_FINAL_DATA.
    *****Mail Data Decleration.
    DATA : BEGIN OF MAIL_TAB OCCURS 0 ,
                ZE_NAME               LIKE KNA1-NAME1,
                ZS_NAME               LIKE KNA1-NAME1,
                NAME              LIKE KNA1-NAME1,
                ORT01             LIKE KNA1-ORT01, "cITY
                S_NAME            LIKE KNA1-NAME1,
                S_ORT01           LIKE KNA1-ORT01, "cITY
                KLABC             LIKE KNVV-KLABC, " Custoemr Class
                VBELN             LIKE VBAK-VBELN, "sALES oRDER nUMBER
                POSNR             LIKE VBAP-POSNR, "SALES ORDER LINE NUMBER
                ERDAT             LIKE VBAK-ERDAT , " Order Date
                MATNR             LIKE MAKT-MATNR,  "Matrial
                MAKTX             LIKE MAKT-MAKTX, "Matrial DESC
                ZZKDMAT           LIKE VBAP-ZZKDMAT, "Customter Mat. Number
                COLOR(20)         TYPE C,          "Color
                COMPLEX(20)       TYPE C,         "Complex
                WIDTH(10)         TYPE C,          "Width
                KBETR             LIKE KONV-KBETR, " Rate per KG
                WAERS             LIKE KONV-WAERS, "currency
                MEINS             LIKE VBAP-MEINS,  "Base Unit of Measure
                KWMENG            LIKE VBAP-KWMENG, " Order Quantity
                BAL_QTY           LIKE VBFA-RFMNG, " Balance QTY
                EDATU             LIKE VBEP-EDATU, "Schedule line date
                DAYS(5)          TYPE C, " Sch.Delay
                BSTNK             LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
                BSTDK             LIKE VBAK-BSTDK,  "Customer purchase order date
                ZA_NAME               LIKE KNA1-NAME1,
                ZI_NAME               LIKE KNA1-NAME1,
                ZR_NAME               LIKE KNA1-NAME1,
                MVGR1(20)         TYPE C          , " Matrial Group
                ZZCUST_REQDAT     LIKE VBAP-ZZCUST_REQDAT, " REquested Date
                ZZBRAND           LIKE VBAP-ZZBRAND, " bRAND
           END OF MAIL_TAB.
    DATA : IT_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
    DATA : SM_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
    DATA : SP_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
    DATA:   IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
            T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
            T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            W_CNT TYPE I,
            W_SENT_ALL(1) TYPE C,
            W_DOC_DATA LIKE SODOCCHGI1,
            GD_ERROR    TYPE SY-SUBRC,
            GD_RECIEVER TYPE SY-SUBRC.
    DATA STR_VAL TYPE STRING.
    CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
    CONSTANTS:
        CON_TAB  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
        CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
    DATA: GT_VBAK_KNA1 LIKE GT_VBAK OCCURS 0 WITH HEADER LINE,
          GT_VBAP_VBPA LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
          GT_VBAP_MAKT LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
          GT_MVKE_TVM1T LIKE GT_MVKE OCCURS 0 WITH HEADER LINE,
          GT_VBAP_MSKA LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
          GT_VBPA_KNA1 LIKE GT_VBPA OCCURS 0 WITH HEADER LINE,
          GT_VBFA_VBUK LIKE GT_VBFA OCCURS 0 WITH HEADER LINE,
          GT_VBAP_INOB LIKE GT_VBAP OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF GT_INOB  OCCURS 0.
              INCLUDE STRUCTURE INOB.
    DATA : END OF GT_INOB.
    DATA: BEGIN OF GT_YCAT_PARAMS OCCURS 0,
           KEY01 TYPE YYKEY01_C10,
           KEY02 TYPE YYKEY02_C16,
           KEY03 TYPE YYKEY03_C20,
           SRNO TYPE YYSRNO_N4,
           VALUE TYPE YYVALUE_C25,
          END OF GT_YCAT_PARAMS.
    DATA: BEGIN OF GT_CABN OCCURS 0,
           ATINN LIKE CABN-ATINN,
           ATNAM LIKE CABN-ATNAM,
          END OF GT_CABN.
    DATA: BEGIN OF GT_AUSP OCCURS 0,
           OBJEK LIKE AUSP-OBJEK,
           ATINN LIKE AUSP-ATINN,
           ATWRT LIKE AUSP-ATWRT,
          END OF GT_AUSP.
    DATA: BEGIN OF GT_CUOBJ OCCURS 0,
          CUOBJ(18) TYPE C,
            CUOBJ TYPE OBJNUM,
          END OF GT_CUOBJ.
    DATA: BEGIN OF GT_CAWN OCCURS 0,
            ATINN LIKE CAWN-ATINN,
            ATZHL LIKE CAWN-ATZHL,
            ATWRT LIKE CAWN-ATWRT,
         END OF GT_CAWN.
    DATA: BEGIN OF GT_CAWNT OCCURS 0,
            ATINN LIKE CAWNT-ATINN,
            ATZHL LIKE CAWNT-ATZHL,
            SPRAS LIKE CAWNT-SPRAS,
            ATWTB LIKE CAWNT-ATWTB,
         END OF GT_CAWNT.
                          START-OF-SELECTION                             *
    INITIALIZATION.
      VARIANT = 'Display Options'.
    RB1 = 'X'.
    REPNAME = SY-REPID.
      PERFORM BUILD_EVENTTAB USING EVENTS[].
      PERFORM BUILD_LAYOUT .
      PERFORM INITIALIZE_VARIANT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM F4_FOR_VARIANT.
    AT SELECTION-SCREEN.
      PERFORM PAI_OF_SELECTION_SCREEN.
    END-OF-SELECTION.
      PERFORM SELECT_DATA.
      PERFORM PROCESS_DATA.
      PERFORM FILTER_PATNER_DATA.
      IF P_FILE = 'X'.
        PERFORM OUT_PUT_FILE.
      ELSEIF P_SCREEN = 'X'.
        PERFORM FILED_CAT_LOG.
        PERFORM CREATE_ALV_LAYOUT.
    PERFORM fill_events.
        PERFORM OUT_PUT_DATA.
      ELSEIF P_MAIL = 'X'.
        PERFORM MAIL_RPT.
      ENDIF.
    *=================Start of Internal table Declaration===================
    *===========
    *&      Form  SELECT_DATA
          sELECTING DATA FROM dATA bASE
    FORM SELECT_DATA .
      REFRESH R_PARVW.
      R_PARVW-SIGN = 'I'.
      R_PARVW-OPTION = 'EQ'.
      IF  NOT  S_ZE[] IS INITIAL.
        R_PARVW-LOW = S_ZE-LOW.
        APPEND R_PARVW.
      ENDIF.
      IF  NOT  S_ZS[] IS INITIAL.
        R_PARVW-LOW = S_ZS-LOW.
        APPEND R_PARVW.
      ENDIF.
      IF  NOT  S_ZA[] IS INITIAL.
        R_PARVW-LOW = S_ZA-LOW.
        APPEND R_PARVW.
      ENDIF.
      IF  NOT  S_ZR[] IS INITIAL.
        R_PARVW-LOW = S_ZR-LOW.
        APPEND R_PARVW.
      ENDIF.
      IF  NOT  S_ZI[] IS INITIAL.
        R_PARVW-LOW = S_ZI-LOW.
        APPEND R_PARVW.
      ENDIF.
    R_PARVW-LOW = 'SH'.
    APPEND R_PARVW.
    sELECTING DATA FROM VBAK TABLE INTO INTERNAL TABLE GT_VBAK
      SELECT  VBELN ERDAT AUART
              VTWEG SPART KNUMV
              BSTNK BSTDK KUNNR
               ZOA_RECP_PLAN_DT
        INTO TABLE GT_VBAK
        FROM VBAK
              WHERE VBELN IN S_VBELN
              AND ERDAT IN S_ERDAT
              AND VBTYP = 'C'
              AND AUART IN S_AUART
              AND AUGRU IN S_AUGRU
              AND VKORG IN S_VKORG
              AND VTWEG IN S_VTWEG
              AND VKGRP IN S_VKGRP
              AND VKBUR IN S_VKBUR
              AND BSTNK  IN S_BSTNK
              AND KUNNR IN S_KUNNR.
      SORT GT_VBAK[] BY VBELN.
      IF NOT GT_VBAK[] IS INITIAL.
    Selecting data from VBAP into Internal tabl gt_vbap
        IF P_BLOCK = 'X' .
          SELECT  VBELN   POSNR
                  MATNR  ABGRU
                  MEINS   FAKSP
                  NETWR KWMENG
                  WERKS   LGORT
                  ROUTE ZZWIDTH
                  ZZKDMAT ZZBRAND
                  ZZSPLDIA ZZCUST_REQDAT
                  ZZCOATING ZZWEIGHT
                  ZZWEIGHT_UMO
            INTO TABLE GT_VBAP
            FROM VBAP
            FOR ALL ENTRIES IN GT_VBAK
            WHERE VBELN = GT_VBAK-VBELN
            AND MATNR IN S_MATNR
            AND ABGRU <> ''
            AND WERKS IN S_WERKS
        ELSEIF P_PEN = 'X'.
          SELECT  VBELN   POSNR
                  MATNR  ABGRU
                  MEINS   FAKSP
                  NETWR KWMENG
                  WERKS   LGORT
                  ROUTE ZZWIDTH
                  ZZKDMAT ZZBRAND
                  ZZSPLDIA ZZCUST_REQDAT
                  ZZCOATING ZZWEIGHT
                  ZZWEIGHT_UMO
            INTO TABLE GT_VBAP
            FROM VBAP
            FOR ALL ENTRIES IN GT_VBAK
            WHERE VBELN = GT_VBAK-VBELN
            AND MATNR IN S_MATNR
            AND FAKSP <> '10'
            AND WERKS IN S_WERKS.
        ELSE.
             SELECT  VBELN   POSNR
                  MATNR  ABGRU
                  MEINS   FAKSP
                  NETWR KWMENG
                  WERKS   LGORT
                  ROUTE ZZWIDTH
                  ZZKDMAT ZZBRAND
                  ZZSPLDIA ZZCUST_REQDAT
                  ZZCOATING ZZWEIGHT
                  ZZWEIGHT_UMO
            INTO TABLE GT_VBAP
            FROM VBAP
            FOR ALL ENTRIES IN GT_VBAK
            WHERE VBELN = GT_VBAK-VBELN
            AND MATNR IN S_MATNR
            AND WERKS IN S_WERKS.
        ENDIF.
      ENDIF.
    IF P_PEN = 'X'.
       SELECT VBELN POSNR GBSTA FROM VBUP INTO TABLE GT_VBUP
              FOR ALL ENTRIES IN GT_VBAP
              WHERE VBELN = GT_VBAP-VBELN AND  POSNR = GT_VBAP-POSNR AND
              GBSTA <> 'C'.
       SORT GT_VBUP[] BY VBELN.
       LOOP AT GT_VBAP.
         READ TABLE GT_VBUP WITH KEY VBELN = GT_VBAP-VBELN
                                     POSNR = GT_VBAP-POSNR.
         IF SY-SUBRC <> 0.
           DELETE GT_VBAP.
         ENDIF.
         CLEAR GT_VBUP.
       ENDLOOP.
        LOOP AT GT_VBAK.
          READ TABLE GT_VBAP WITH KEY VBELN = GT_VBAK-VBELN.
          IF SY-SUBRC <> 0.
            DELETE GT_VBAK.
          ENDIF.
          CLEAR GT_VBAP.
        ENDLOOP.
    ENDIF.
      IF NOT GT_VBAP[] IS INITIAL.
        GT_VBAP_INOB[] = GT_VBAP[].
    SORT GT_VBAP_INOB[] BY MATNR.
    DELETE ADJACENT DUPLICATES FROM GT_VBAP_INOB COMPARING MATNR.
    SELECT * FROM INOB INTO TABLE GT_INOB
         WHERE KLART = '023'
             AND  OBTAB = 'MARA'.
    IF SY-SUBRC = 0.
       SELECT  KEY01 KEY02 KEY03 SRNO VALUE
                     INTO TABLE Gt_YCAT_PARAMS
                     FROM  YCAT_PARAMS
                                 WHERE KEY01 = 'CHAR_NAME'
                                 AND   KEY02 = 'ATNAM'
                                 AND  ( KEY03 = 'COLOR' OR  KEY03 = 'COMPLEX' )
                                 AND   SRNO  = '0001'.
    SELECT ATINN ATNAM INTO TABLE GT_CABN FROM CABN
                              WHERE ( ATNAM = 'COLOUR' OR ATNAM = 'COMPLEX' ).
    LOOP AT GT_INOB.
    GT_CUOBJ-CUOBJ = GT_INOB-CUOBJ.
    APPEND GT_CUOBJ.
    ENDLOOP.
    SELECT OBJEK ATINN ATWRT
          INTO TABLE GT_AUSP FROM AUSP
             FOR ALL ENTRIES IN GT_CUOBJ
              WHERE OBJEK = GT_CUOBJ-CUOBJ.
             AND   ATINN = L_ATINN.
    SELECT ATINN ATZHL ATWRT INTO TABLE GT_CAWN
            FROM CAWN FOR ALL ENTRIES IN GT_AUSP
              WHERE ATWRT = GT_AUSP-ATWRT.
    SELECT ATINN ATZHL SPRAS ATWTB INTO TABLE GT_CAWNT
           FROM CAWNT FOR ALL ENTRIES IN GT_CAWN
              WHERE ATINN = GT_CAWN-ATINN
              AND   ATZHL = GT_CAWN-ATZHL
              AND SPRAS = 'EN'.
    ENDIF.
    Selecting data from VBeP into Internal tabl gt_vbep
        SORT GT_VBAP[] BY VBELN POSNR.
        SELECT  VBELN POSNR
                ETENR EDATU
          INTO TABLE GT_VBEP
          FROM VBEP
          FOR ALL ENTRIES IN GT_VBAP
          WHERE VBELN = GT_VBAP-VBELN
          AND POSNR = GT_VBAP-POSNR
          AND EDATU IN S_EDATU
               AND BMENG <> 0.
        SELECT SPRAS ROUTE BEZEI
              INTO TABLE GT_TVROT
              FROM TVROT
             WHERE SPRAS = 'EN'.
      ENDIF.
      IF NOT GT_VBAP[] IS INITIAL.
        GT_VBAP_VBPA[] = GT_VBAP[].
        SORT GT_VBAP_VBPA[] BY VBELN.
        DELETE ADJACENT DUPLICATES FROM GT_VBAP_VBPA COMPARING VBELN.
    Selecting data from  VBPA into Internal tabl GT_VBPA
        IF NOT R_PARVW[] IS INITIAL.
          SELECT VBELN POSNR
                 PARVW KUNNR
            INTO TABLE GT_VBPA
            FROM VBPA
            FOR ALL ENTRIES IN  GT_VBAP_VBPA
            WHERE VBELN = GT_VBAP_VBPA-VBELN
            AND (  PARVW  IN R_PARVW
            OR PARVW = 'WE' ).
        ELSE.
          SELECT VBELN POSNR
                 PARVW KUNNR
            INTO TABLE GT_VBPA
            FROM VBPA
            FOR ALL ENTRIES IN  GT_VBAP_VBPA
            WHERE VBELN = GT_VBAP_VBPA-VBELN
            AND  ( PARVW  = 'ZE'
            OR  PARVW = 'ZS'
            OR PARVW = 'ZA'
            OR  PARVW = 'ZR'
            OR  PARVW = 'ZI' OR PARVW = 'WE' ).
        ENDIF.
      ENDIF.
      SORT GT_VBPA[].
      GT_VBPA_KNA1[] = GT_VBPA[].
      SORT GT_VBPA_KNA1[] BY KUNNR.
      DELETE ADJACENT DUPLICATES FROM GT_VBPA_KNA1 COMPARING KUNNR.
      IF NOT GT_VBPA_KNA1[] IS INITIAL.
        SELECT KUNNR NAME1 ORT01 FROM KNA1 INTO TABLE
               GT_KNA1_1 FOR ALL ENTRIES IN GT_VBPA_KNA1
                WHERE KUNNR = GT_VBPA_KNA1-KUNNR.
      ENDIF.
    Selecting data from  VBKD into Internal tabl GT_VBKD
      IF NOT GT_VBAK[] IS INITIAL.
        SELECT VBELN  KDGRP
               INCO1 INCO2
               ZTERM  STCUR
          INTO TABLE GT_VBKD
          FROM VBKD
          FOR ALL ENTRIES IN GT_VBAK
          WHERE VBELN = GT_VBAK-VBELN
          AND PRSDT <> ''.
    Selecting data from VBFA into Internal table gt_vbfa
        IF P_PEN = 'X'.
            SELECT VBFAVBELV   VBFAPOSNV
                    VBFAVBELN   VBFAPOSNN
                    VBFAVBTYP_N VBFARFMNG
               INTO TABLE GT_VBFA
               FROM VBFA INNER JOIN
               VBAK ON VBFAVBELV = VBAKVBELN
               WHERE
               ( VBFA~VBTYP_N = 'J' OR
                     VBFA~VBTYP_N = 'R').
    LOOP AT GT_VBFA.
         READ TABLE GT_VBAK WITH KEY VBELN = Gt_VBFA-VBELV.
           IF SY-SUBRC <> 0.
             DELETE GT_VBFA.
           ENDIF.
    CLEAR GT_VBFA.
    ENDLOOP.
         SELECT VBELV   POSNV
                   VBELN   POSNN
                   VBTYP_N RFMNG
              INTO TABLE GT_VBFA
              FROM VBFA
              FOR ALL ENTRIES IN GT_VBAK
              WHERE VBELV = GT_VBAK-VBELN
              AND ( VBTYP_N = 'J' OR
                    VBTYP_N = 'R').
        ELSE.
          SELECT VBELV   POSNV
                 VBELN   POSNN
                 VBTYP_N RFMNG
            INTO TABLE GT_VBFA
            FROM VBFA
            FOR ALL ENTRIES IN GT_VBAK
            WHERE VBELV = GT_VBAK-VBELN
            AND VBTYP_N = 'J'.
        ENDIF.
        SORT GT_VBFA[].
        IF GT_VBFA[] IS NOT INITIAL.
          GT_VBFA_VBUK[] = GT_VBFA[].
          SORT GT_VBFA_VBUK[] BY VBELN.
          DELETE ADJACENT DUPLICATES FROM GT_VBFA_VBUK COMPARING VBELN.
          SELECT VBELN WBSTK FROM VBUK INTO TABLE GT_VBUK
               FOR ALL ENTRIES IN GT_VBFA_VBUK
                  WHERE VBELN = GT_VBFA_VBUK-VBELN.
        ENDIF.
             -----------Selection data from KONv into Internal table gt_konv
        SORT GT_VBAK[] BY KNUMV.
        SELECT KNUMV KPOSN KSCHL
               KBETR WAERS KWERT
             INTO TABLE GT_KONV
             FROM KONV
             FOR ALL ENTRIES IN GT_VBAK
             WHERE KNUMV = GT_VBAK-KNUMV
             AND ( KSCHL = 'ZBAP'
                  OR   KSCHL = 'JEXP'
                  OR   KSCHL = 'JEDC'
                  OR   KSCHL = 'JEDH'
                  OR   KSCHL = 'ZJIP'
                  OR   KSCHL = 'ZCOM'
                  OR   KSCHL = 'JIVC'
                  OR   KSCHL   = 'JFRE' ).
      ENDIF.
      IF NOT GT_VBAP[] IS INITIAL.
    sELECING dATA FROM MSKA INTO INTERNAL TABLE GT_MSKA
        GT_VBAP_MSKA[] = GT_VBAP[].
        SORT GT_VBAP_MSKA[] BY MATNR WERKS VBELN POSNR.
        DELETE ADJACENT DUPLICATES FROM GT_VBAP_MSKA COMPARING MATNR WERKS VBELN POSNR.
        SELECT  MATNR  WERKS
                LGORT  CHARG
                SOBKZ  VBELN
                POSNR
                KALAB  KAINS
          INTO TABLE GT_MSKA
          FROM MSKA
          FOR ALL ENTRIES IN GT_VBAP_MSKA
          WHERE MATNR = GT_VBAP_MSKA-MATNR
          AND WERKS = GT_VBAP_MSKA-WERKS
       AND LGORT = GT_VBAP-LGORT
          AND VBELN = GT_VBAP_MSKA-VBELN
          AND POSNR = GT_VBAP_MSKA-POSNR.
        SORT GT_MSKA[].
        DATA :BEGIN OF TMP_MATNR OCCURS 0,
               MATNR LIKE MARA-MATNR,
              END OF TMP_MATNR.
        LOOP AT GT_VBAP.
          TMP_MATNR-MATNR = GT_VBAP-MATNR.
          TMP_MATNR-MATNR+0(1) ='S'.
          APPEND TMP_MATNR.
        ENDLOOP.
        SORT TMP_MATNR[].
        DELETE ADJACENT DUPLICATES FROM TMP_MATNR COMPARING MATNR.
        SELECT MATNR
               WERKS
               LGORT
               LABST
          FROM MARD
          INTO TABLE GT_MARD
          FOR ALL ENTRIES IN TMP_MATNR
          WHERE MATNR = TMP_MATNR-MATNR."'SDX25000B040GC01'."GT_VBAP-MATNR.
      ENDIF.
      SORT GT_MARD[].
      IF NOT GT_VBAK[] IS INITIAL.
        GT_VBAK_KNA1[] = GT_VBAK[].
        SORT GT_VBAK_KNA1[] BY KUNNR.
        DELETE ADJACENT DUPLICATES FROM GT_VBAK_KNA1 COMPARING KUNNR.
        SELECT  KUNNR
                     NAME1
                     NAME2
                     ORT01
             FROM KNA1
             INTO TABLE GT_KNA1
             FOR ALL ENTRIES IN GT_VBAK_KNA1
             WHERE KUNNR = GT_VBAK_KNA1-KUNNR.
        SELECT KUNNR  KLABC
          FROM KNVV
         INTO TABLE GT_KNVV
         FOR ALL ENTRIES IN GT_VBAK_KNA1
         WHERE KUNNR = GT_VBAK_KNA1-KUNNR.
      ENDIF.
      IF NOT GT_VBAP[] IS INITIAL.
        GT_VBAP_MAKT[] = GT_VBAP[].
        SORT GT_VBAP_MAKT[] BY MATNR.
        DELETE ADJACENT DUPLICATES FROM GT_VBAP_MAKT COMPARING MATNR.
        SELECT   MATNR
                 SPRAS
                 MAKTX
             FROM MAKT
             INTO TABLE GT_MAKT
             FOR ALL ENTRIES IN GT_VBAP_MAKT
             WHERE MATNR = GT_VBAP_MAKT-MATNR AND
                   SPRAS = 'EN'.
        SELECT MATNR
               MVGR1
          FROM MVKE
          INTO TABLE GT_MVKE
          FOR ALL ENTRIES IN GT_VBAP_MAKT
          WHERE MATNR = GT_VBAP_MAKT-MATNR
          AND MVGR1 <> ''.
      ENDIF.
      IF NOT GT_MVKE[] IS INITIAL.
        GT_MVKE_TVM1T[] = GT_MVKE[].
        SORT GT_MVKE_TVM1T[] BY MVGR1.
        DELETE ADJACENT DUPLICATES FROM GT_MVKE_TVM1T COMPARING MVGR1.
        SELECT SPRAS MVGR1 BEZEI
            FROM TVM1T
            INTO TABLE GT_TVM1T
            FOR ALL ENTRIES IN GT_MVKE_TVM1T
            WHERE SPRAS = 'EN' AND
              MVGR1 = GT_MVKE_TVM1T-MVGR1.
      ENDIF.
      IF NOT GT_VBAK[] IS INITIAL.
        SELECT SPRAS
               SPART
               VTEXT
          FROM TSPAT
          INTO TABLE GT_TSPAT
          WHERE SPRAS = 'EN'.
        SELECT  SPRAS
                VTWEG
                VTEXT
              FROM TVTWT
              INTO TABLE GT_TVTWT
              WHERE SPRAS = 'EN'.
        SELECT SPRAS AUART BEZEI
              FROM TVAKT
              INTO TABLE GT_TVAKT
              WHERE
               SPRAS = 'EN'.
      ENDIF.
      IF NOT GT_VBKD[] IS INITIAL.
        SELECT SPRAS KDGRP
               KTEXT
               FROM T151T
          INTO TABLE GT_T151T
        FOR ALL ENTRIES IN GT_VBKD
         WHERE SPRAS = 'EN' .
         AND
             KDGRP = GT_VBKD-KDGRP.
      ENDIF.
      IF NOT GT_VBKD[] IS INITIAL.
        SELECT SPRAS ZTERM TEXT1
          FROM T052U
          INTO TABLE GT_T052U
        FOR ALL ENTRIES IN GT_VBKD
          WHERE SPRAS = 'EN'.
          AND ZTERM = GT_VBKD-ZTERM.
      ENDIF.
    ENDFORM.                    " SELECT_DATA
    *&      Form  PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM PROCESS_DATA .
      DATA : T_FLAG(2) TYPE C,
             J_AMT LIKE VBFA-RFMNG,
             M_AMT LIKE VBFA-RFMNG,
             R_AMT LIKE VBFA-RFMNG,
             N_AMT LIKE VBFA-RFMNG,
             JR_AMT LIKE VBFA-RFMNG,
             MN_AMT LIKE VBFA-RFMNG,
             TMP_WBSTK LIKE VBUK-WBSTK,
             SFG_MATNR LIKE MARD-MATNR.
      LOOP AT GT_VBAP.
        CLEAR : GT_FINAL_DATA,
              J_AMT ,
             M_AMT ,
             R_AMT,
             N_AMT ,
             JR_AMT ,
             SFG_MATNR,
             MN_AMT .
        READ TABLE GT_VBAK WITH KEY VBELN = GT_VBAP-VBELN.
        IF SY-SUBRC = 0.
          GT_FINAL_DATA-KUNNR    = GT_VBAK-KUNNR.
          GT_FINAL_DATA-VBELN  = GT_VBAK-VBELN.
          GT_FINAL_DATA-POSNR = GT_VBAP-POSNR.
          GT_FINAL_DATA-ABGRU = GT_VBAP-ABGRU.
        ENDIF.
        READ TABLE GT_KNA1 WITH KEY KUNNR = GT_VBAK-KUNNR.
        IF SY-SUBRC = 0.
          GT_FINAL_DATA-NAME = GT_KNA1-NAME1.
          GT_FINAL_DATA-ORT01 = GT_KNA1-ORT01.
        ENDIF.
        READ TABLE GT_KNVV WITH KEY KUNNR = GT_VBAK-KUNNR.
        IF SY-SUBRC = 0.
          GT_FINAL_DATA-KLABC = GT_KNVV-KLABC.
        ENDIF.
        IF SY-SUBRC = 0.
          READ TABLE GT_VBKD WITH KEY VBELN = GT_VBAK-VBELN.
          GT_FINAL_DATA-INCO1 = GT_VBKD-INCO1. "Incoterms (Part 1)
          GT_FINAL_DATA-INCO2 = GT_VBKD-INCO2. "Incoterms (Part 2)
          GT_FINAL_DATA-ZTERM = GT_VBKD-ZTERM. " Payment Term
        ENDIF.
        LOOP AT  GT_MSKA WHERE  MATNR = GT_VBAP-MATNR
                         AND    WERKS = GT_VBAP-WERKS
                         AND    LGORT = GT_VBAP-LGORT
                         AND    VBELN = GT_VBAP-VBELN
                         AND    POSNR = GT_VBAP-POSNR.
          GT_FINAL_DATA-KALAB = GT_FINAL_DATA-KALAB  + GT_MSKA-KALAB. "Unrestricted-Use Stock
          GT_FINAL_DATA-KAINS = GT_FINAL_DATA-KAINS + GT_MSKA-KAINS. " Stock in Quality Inspection
        ENDLOOP.
        SFG_MATNR = GT_VBAP-MATNR.
        SFG_MATNR+0(1) ='S'.
        READ TABLE  GT_MARD WITH KEY  MATNR = SFG_MATNR
                               WERKS = GT_VBAP-WERKS
                           LGORT = 'SF01'.
       loop at gt_mard where MATNR = SFG_MATNR
                       and  WERKS = GT_VBAP-WERKS.
        IF SY-SUBRC = 0.
          GT_FINAL_DATA-LABST =   GT_FINAL_DATA-LABST + GT_MARD-LABST . "Valuated Unrestricted-Use Stock
        ENDIF.
       endloop.
        GT_FINAL_DATA-MATNR = GT_VBAP-MATNR.  "Matrial
        GT_FINAL_DATA-ZZKDMAT = GT_VBAP-ZZKDMAT. " Customer Mat. N

    Hi Rajan,
    There is a lot of scope for performance tuning the code:
    1. Read statement should be with BINARY SEARCH
    2. Select statement should have FIELDS in the same order as they exist in the table
    3. Select statement where clause should have fields in same order as they exist in the table.
    4. Internal tables seem to be having a huge number of fields. If possible, please limit the fields to only required fields in the internal table.
    Best regards,
    Prashant

  • 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.

  • 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                          |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                     

  • 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/

Maybe you are looking for

  • Mapping not sufficiently defined FILE TO IDOC(HRMD_A.HRMD_A06) scenerio

    Hello friends,                      In message mapping part from File to IDOC. I am doing mapping of infotype 14 message type with the corresponding idoc. But when I activate it I am getting the following error: Activation of the change list canceled

  • EBay notices not being received

    I have been using eBay for over 10 years and have never had an issue with receiving mail from eBay. Since Lion, I am not receiving the messages from eBay, none of the : New listings, ending bid notice or messages from other eBay customers. There are

  • XML Export

    I have a Crstal report which presently prints a medical billing record consisting of header, multiple detail lines and a footer. The company that these are sent to has provided an .xsd file to enable us to transmit the billing as XML files.  This wil

  • SET DELETION FLAG FOR ORDER

    Dear friends, once maintenance order has been released,I am unable to put deletation flag for that order. is there any option to put deletion flag after releasing maint order other than locking your response is highly appriciated. Regards, K.Sunil

  • OSM - Central Order Managment - Service Order Managment

    Hi! I'm studing OSM. Now, I have a problem. How the request Order passes from COM (Central Order Managment) to the SOM (Service Order Managment) ? Thanks