Help on performence tunning?

hi, pls send detals

hi,
some hands on notes.
http://www.erpgenie.com/abap/performance.htm
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
Performance tuning for Data Selection Statement 
For all entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of 
entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the 
length of the WHERE clause. 
The plus
Large amount of data 
Mixing processing and reading of data 
Fast internal reprocessing of data 
Fast 
The Minus
Difficult to program/understand 
Memory could be critical (use FREE or PACKAGE size) 
Some steps that might make FOR ALL ENTRIES more efficient:
Removing duplicates from the the driver table 
Sorting the driver table 
If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
FOR ALL ENTRIES IN i_tab
  WHERE mykey >= i_tab-low and
        mykey <= i_tab-high.
Nested selects
The plus:
Small amount of data 
Mixing processing and reading of data 
Easy to code - and understand 
The minus:
Large amount of data 
when mixed processing isn’t needed 
Performance killer no. 1
Select using JOINS
The plus
Very large amount of data 
Similar to Nested selects - when the accesses are planned by the programmer 
In some cases the fastest 
Not so memory critical 
The minus
Very difficult to program/understand 
Mixing processing and reading of data not possible 
Use the selection criteria
SELECT * FROM SBOOK.                   
  CHECK: SBOOK-CARRID = 'LH' AND       
                  SBOOK-CONNID = '0400'.        
ENDSELECT.                             
SELECT * FROM SBOOK                     
  WHERE CARRID = 'LH' AND               
        CONNID = '0400'.                
ENDSELECT.                              
Use the aggregated functions
C4A = '000'.              
SELECT * FROM T100        
  WHERE SPRSL = 'D' AND   
        ARBGB = '00'.     
  CHECK: T100-MSGNR > C4A.
  C4A = T100-MSGNR.       
ENDSELECT.                
SELECT MAX( MSGNR ) FROM T100 INTO C4A 
WHERE SPRSL = 'D' AND                
       ARBGB = '00'.                  
Select with view
SELECT * FROM DD01L                    
  WHERE DOMNAME LIKE 'CHAR%'           
        AND AS4LOCAL = 'A'.            
  SELECT SINGLE * FROM DD01T           
    WHERE   DOMNAME    = DD01L-DOMNAME 
        AND AS4LOCAL   = 'A'           
        AND AS4VERS    = DD01L-AS4VERS 
        AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             
SELECT * FROM DD01V                    
WHERE DOMNAME LIKE 'CHAR%'           
       AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             
Select with index support
SELECT * FROM T100            
WHERE     ARBGB = '00'      
       AND MSGNR = '999'.    
ENDSELECT.                    
SELECT * FROM T002.             
  SELECT * FROM T100            
    WHERE     SPRSL = T002-SPRAS
          AND ARBGB = '00'      
          AND MSGNR = '999'.    
  ENDSELECT.                    
ENDSELECT.                      
Select … Into table
REFRESH X006.                 
SELECT * FROM T006 INTO X006. 
  APPEND X006.                
ENDSELECT
SELECT * FROM T006 INTO TABLE X006.
Select with selection list
SELECT * FROM DD01L              
  WHERE DOMNAME LIKE 'CHAR%'     
        AND AS4LOCAL = 'A'.      
ENDSELECT
SELECT DOMNAME FROM DD01L    
INTO DD01L-DOMNAME         
WHERE DOMNAME LIKE 'CHAR%' 
       AND AS4LOCAL = 'A'.  
ENDSELECT
Key access to multiple lines
LOOP AT TAB.          
CHECK TAB-K = KVAL. 
ENDLOOP.              
LOOP AT TAB WHERE K = KVAL.     
ENDLOOP.                        
Copying internal tables
REFRESH TAB_DEST.              
LOOP AT TAB_SRC INTO TAB_DEST. 
  APPEND TAB_DEST.             
ENDLOOP.                       
TAB_DEST[] = TAB_SRC[].
Modifying a set of lines
LOOP AT TAB.             
  IF TAB-FLAG IS INITIAL.
    TAB-FLAG = 'X'.      
  ENDIF.                 
  MODIFY TAB.            
ENDLOOP.                 
TAB-FLAG = 'X'.                  
MODIFY TAB TRANSPORTING FLAG     
           WHERE FLAG IS INITIAL.
Deleting a sequence of lines
DO 101 TIMES.               
  DELETE TAB_DEST INDEX 450.
ENDDO.                      
DELETE TAB_DEST FROM 450 TO 550.
Linear search vs. binary
READ TABLE TAB WITH KEY K = 'X'.
READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
Comparison of internal tables
DESCRIBE TABLE: TAB1 LINES L1,      
                TAB2 LINES L2.      
IF L1 <> L2.                        
  TAB_DIFFERENT = 'X'.              
ELSE.                               
  TAB_DIFFERENT = SPACE.            
  LOOP AT TAB1.                     
    READ TABLE TAB2 INDEX SY-TABIX. 
    IF TAB1 <> TAB2.                
      TAB_DIFFERENT = 'X'. EXIT.    
    ENDIF.                          
  ENDLOOP.                          
ENDIF.                              
IF TAB_DIFFERENT = SPACE.           
ENDIF.                              
IF TAB1[] = TAB2[].  
ENDIF.               
Modify selected components
LOOP AT TAB.           
TAB-DATE = SY-DATUM. 
MODIFY TAB.          
ENDLOOP.               
WA-DATE = SY-DATUM.                    
LOOP AT TAB.                           
MODIFY TAB FROM WA TRANSPORTING DATE.
ENDLOOP.                               
Appending two internal tables
LOOP AT TAB_SRC.              
  APPEND TAB_SRC TO TAB_DEST. 
ENDLOOP
APPEND LINES OF TAB_SRC TO TAB_DEST.
Deleting a set of lines
LOOP AT TAB_DEST WHERE K = KVAL. 
  DELETE TAB_DEST.               
ENDLOOP
DELETE TAB_DEST WHERE K = KVAL.
Tools available in SAP to pin-point a performance problem
The runtime analysis (SE30)
SQL Trace (ST05)
Tips and Tricks tool
The performance database
Optimizing the load of the database
Using table buffering
Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:
Select DISTINCT 
ORDER BY / GROUP BY / HAVING clause 
Any WHERE clasuse that contains a subquery or IS NULL expression 
JOIN s 
A SELECT... FOR UPDATE 
If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause.
Use the ABAP SORT Clause Instead of ORDER BY
The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.
If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.
Avoid ther SELECT DISTINCT Statement
As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciates.
SE30 - gives you a run time analysis and points out the issues more at design time.
ST05 - Is the most useful if you want to track time taken for execution of each of the sections.
SM50 - Will give you a work process overview, not sure at a program level how can it help you.
Some times you will have to use a combination of SE30 and ST05.
I would like to use St05 personally.
regards
anver
if helped pls amrk points

Similar Messages

  • Performence Tunning

    Hi All,
    I am looking for refrence book for oracle 10g performence tunning.
    Could you please advice me the name of some refrence book, which can help me to know the in and out concept of performence tunning from administration point of view.
    Regards,
    SS

    http://www.amazon.com/Optimizing-Oracle-Performance-Cary-Millsap/dp/059600527X/ref=sr_1_3?ie=UTF8&qid=1249398898&sr=8-3
    http://www.amazon.com/Troubleshooting-Oracle-Performance-Christian-Antognini/dp/1590599179/ref=sr_1_5?ie=UTF8&qid=1249398898&sr=8-5
    http://www.amazon.com/Oracle-Wait-Interface-Performance-Diagnostics/dp/007222729X/ref=sr_1_6?ie=UTF8&qid=1249398898&sr=8-6
    http://www.amazon.com/Cost-Based-Oracle-Fundamentals-Experts-Voice/dp/1590596366/ref=sr_1_14?ie=UTF8&qid=1249398898&sr=8-14
    to start with.

  • Help me query tunning

    Hi Guru's
    Can you please help me query tunning.
    Database Version : Oracle 11g - 11.2.0.3
    select  distinct  corporation_name custer_name,
            glog_util.remove_domain(SHIP_BUY.SERVPROV_GID ) SCAC,
            glog_util.remove_domain(ship_buy.shipment_gid) buy_shipment_gid,
            F_Get_SELL_ID_STRING(SHIP_BUY.SHIPMENT_GID) sell_shipment_gid,
            ship_buy.domain_name,    
            F_GET_ORDER_RELEASE_GID('B',SHIP_BUY.SHIPMENT_GID,0) ORDER_RELEASE_GID,
            f_get_refnum_string('SHIPMENT', ship_buy.shipment_gid, 'MBOL_NUMBER_CLEANSED')MBOL_NUMBER,
            F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID) POD_RECEIVED_DATE,
            f_get_exp_accrue_amt(ship_buy.shipment_gid,'SHIPMENT') Total_accrual_amount    
    from shipment ship_buy,
            invoice inv,
            invoice_shipment si,
            --voucher v,
            corporation corp
    where corp.domain_name=ship_buy.domain_name
            and corp.is_domain_master='Y'
          and 1=1
          AND ship_buy.domain_name like 'UPS/CP/DFP/%'
          and F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
            --and V.INVOICE_GID(+) = inv.invoice_gid
            --and ship_buy.domain_name = 'UPS/CP/VZNB'
            and si.shipment_gid(+) = SHIP_BUY.SHIPMENT_GID
            AND SI.INVOICE_GID = INV.INVOICE_GID(+)
            and SHIP_BUY.INSERT_DATE > '1-JAN-2007'
            and SHIP_BUY.USER_DEFINED1_ICON_GID = 'ACCEPTED'
    UNION        
    select  distinct  corporation_name custer_name,
            glog_util.remove_domain(SHIP_BUY.SERVPROV_GID ) SCAC,
            glog_util.remove_domain(ship_buy.shipment_gid) buy_shipment_gid,
            F_GET_SELL_ID_STRING( SHIP_BUY.SHIPMENT_GID) sell_shipment_gid,
            ship_buy.domain_name,    
            F_GET_ORDER_RELEASE_GID('B',SHIP_BUY.SHIPMENT_GID,0) ORDER_RELEASE_GID,
            f_get_refnum_string('SHIPMENT', ship_buy.shipment_gid, 'MBOL_NUMBER_CLEANSED')MBOL_NUMBER,
            F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID) POD_RECEIVED_DATE,
            f_get_exp_accrue_amt(inv.invoice_gid,'INVOICE') Total_accrual_amount  
    from shipment ship_buy,
            invoice inv,
            invoice_shipment si,
          -- voucher v,
            corporation corp
    where corp.domain_name=ship_buy.domain_name
            and corp.is_domain_master='Y'
            and 1=1
            AND ship_buy.domain_name like 'UPS/CP/DFP/%'
            and F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
          --AND INV.DOMAIN_NAME = 'UPS/CP/VZNB'
          --and V.INVOICE_GID(+) = inv.invoice_gid
            and si.shipment_gid(+) = SHIP_BUY.SHIPMENT_GID
            AND SI.INVOICE_GID = INV.INVOICE_GID(+)
            and SHIP_BUY.INSERT_DATE > '1-JAN-2007'
            and INV.USER_DEFINED1_ICON_GID = 'ACCEPTED'
    GROUP BY corporation_name,SHIP_BUY.SHIPMENT_GID,SHIP_BUY.SERVPROV_GID,ship_buy.domain_name,inv.invoice_gid
    ORDER BY CUSTER_NAME, BUY_SHIPMENT_GID;
    And I generated the execution plan :
    | Id  | Operation                          | Name                    | Rows  | Bytes | Cost (%CPU)| Time    |
    |  0 | SELECT STATEMENT                  |                        |    3 |  448 |  415  (2)| 00:00:05 |
    |  1 |  SORT UNIQUE                      |                        |    3 |  448 |  414  (87)| 00:00:05 |
    |  2 |  UNION-ALL                        |                        |      |      |            |          |
    |  3 |    NESTED LOOPS OUTER              |                        |    3 |  384 |    57  (0)| 00:00:01 |
    |*  4 |    HASH JOIN                      |                        |    3 |  294 |    54  (0)| 00:00:01 |
    |*  5 |      TABLE ACCESS BY INDEX ROWID  | SHIPMENT                |    3 |  195 |    40  (0)| 00:00:01 |
    |*  6 |      INDEX SKIP SCAN              | IND_SHIP_DOM_ICON      |    54 |      |    25  (0)| 00:00:01 |
    |*  7 |      TABLE ACCESS FULL            | CORPORATION            |    4 |  132 |    14  (0)| 00:00:01 |
    |*  8 |    INDEX RANGE SCAN              | IND_INVOICESHIP_SHP_GID |    1 |    30 |    1  (0)| 00:00:01 |
    |  9 |    HASH GROUP BY                  |                        |    1 |  192 |  356  (1)| 00:00:05 |
    |* 10 |    HASH JOIN                      |                        |    1 |  192 |  354  (1)| 00:00:05 |
    |  11 |      NESTED LOOPS                  |                        |      |      |            |          |
    |  12 |      NESTED LOOPS                |                        |    1 |  159 |  339  (0)| 00:00:05 |
    |  13 |        NESTED LOOPS                |                        |  145 | 13920 |  194  (0)| 00:00:03 |
    |  14 |        TABLE ACCESS BY INDEX ROWID| INVOICE                |  145 |  5220 |    49  (0)| 00:00:01 |
    |* 15 |          INDEX SKIP SCAN          | IDX_INV_TYP_ICON_NAM    |  145 |      |    17  (0)| 00:00:01 |
    |* 16 |        INDEX RANGE SCAN          | UK_INVOICE_SHIPMENT    |    1 |    60 |    1  (0)| 00:00:01 |
    |* 17 |        INDEX UNIQUE SCAN          | PK_SHIPMENT            |    1 |      |    1  (0)| 00:00:01 |
    |* 18 |      TABLE ACCESS BY INDEX ROWID  | SHIPMENT                |    1 |    63 |    1  (0)| 00:00:01 |
    |* 19 |      TABLE ACCESS FULL            | CORPORATION            |    4 |  132 |    14  (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      4 - access("CORP"."DOMAIN_NAME"="SHIP_BUY"."DOMAIN_NAME")
      5 - filter("F_GET_POD_RECEIVED_DATE"("SHIP_BUY"."SHIPMENT_GID")<=TO_DATE(' 2013-07-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss') AND "SHIP_BUY"."INSERT_DATE">TO_DATE(' 2007-01-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))
      6 - access("SHIP_BUY"."USER_DEFINED1_ICON_GID"='ACCEPTED' AND "SHIP_BUY"."DOMAIN_NAME" LIKE
                  'UPS/CP/DFP/%')
          filter("SHIP_BUY"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%' AND
                  "SHIP_BUY"."USER_DEFINED1_ICON_GID"='ACCEPTED')
      7 - filter("CORP"."IS_DOMAIN_MASTER"='Y' AND "CORP"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%')
      8 - access("SI"."SHIPMENT_GID"(+)="SHIP_BUY"."SHIPMENT_GID")
      10 - access("CORP"."DOMAIN_NAME"="SHIP_BUY"."DOMAIN_NAME")
      15 - access("INV"."USER_DEFINED1_ICON_GID"='ACCEPTED')
          filter("INV"."USER_DEFINED1_ICON_GID"='ACCEPTED')
      16 - access("SI"."INVOICE_GID"="INV"."INVOICE_GID")
      17 - access("SI"."SHIPMENT_GID"="SHIP_BUY"."SHIPMENT_GID")
          filter("F_GET_POD_RECEIVED_DATE"("SHIP_BUY"."SHIPMENT_GID")<=TO_DATE(' 2013-07-31 00:00:00',
                  'syyyy-mm-dd hh24:mi:ss'))
      18 - filter("SHIP_BUY"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%' AND "SHIP_BUY"."INSERT_DATE">TO_DATE('
                  2007-01-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      19 - filter("CORP"."IS_DOMAIN_MASTER"='Y' AND "CORP"."DOMAIN_NAME" LIKE 'UPS/CP/DFP/%')
    Statistics
        246247  recursive calls
              2  db block gets
        1660067  consistent gets
          13839  physical reads
              0  redo size
        592054  bytes sent via SQL*Net to client
          6024  bytes received via SQL*Net from client
            502  SQL*Net roundtrips to/from client
          15296  sorts (memory)
              0  sorts (disk)
          7513  rows processed

    Hmmm...why does this look familiar?
    F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_char(to_date('31-JUL-2013', 'DD-MON-YYYY'), 'dd-mon-yyyy')
    SHIP_BUY.INSERT_DATE > '1-JAN-2007'
    Like I said in your other thread about this, these two lines need to be fixed and your function needs to be fixed so the return statement doesn't do an implicit date conversion.
    Can't you see what that first line is doing?  You're taking a character string, turning it into a date, then back to a character string.
    If nothing else, these lines should be...
    F_GET_POD_RECEIVED_DATE (ship_BUY.SHIPMENT_GID)  <= to_date('31-JUL-2013', 'DD-MON-YYYY')
    SHIP_BUY.INSERT_DATE > to_date('01-JAN-2007','DD-MON-YYYY')
    (assuming insert_date is a proper date format, fingers crossed)

  • Help needed to tune the Query:Statistics added

    Can someone DBA please help me to tune this query:
    SELECT DISTINCT K.ATTRIBUTE_VALUE AGENCY_ID,B.PROFILE_NM ,NVL(G.OFFICE_DESC,'--') OFFICE_DESC,f.OFFICE_ID,B.PROFILE_ID,'%' ROLE,'%' LAYOUT,
    CASE
    WHEN 'flagB' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING')
    WHEN 'flagO' = '%' THEN
    NVL(J.ISS_GRP_DESC,'ORDERING')
    WHEN 'flag' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
    ELSE
    NVL(J.ISS_GRP_DESC,' ')
    END ISS_GRP_DESC,
    DECODE(NVL(H.USERID,' ') ,' ','--','<a sbcuid_in=' || H.USERID || ' target=NEW >'||H.FIRSTNAME || ' ' || H.LASTNAME || '( ' || H.USERID || ' )</a>' ) USER_NAME
    FROM
    PROFILE_PORTAL B ,
    TBL_BDA_AGENCY_RESP_REP C ,
    TBL_BDA_AGENCY_OFFICE F,
    TBL_BDA_OFFICE G,
    USERS_PORTAL H,
    TBL_BDA_USR_ISS_GRP I ,
    TBL_BDA_ISS_GROUP J,
    ATTRIBUTE_VALUES_PORTAL K,
    PROFILE_TYPE_PORTAL L
    WHERE
    B.PROFILE_ID = F.AGENCY_ID (+)
    AND B.PROFILE_ID = C.AGENCY_ID (+)
    AND G.OFFICE_ID (+)= F.OFFICE_ID
    AND H.USERID (+)= C.RESP_USR_ID
    AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
    AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
    AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
    AND K.ATTRIBUTE_VALUE IS NOT NULL
    AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
    AND L.APPLICATION_CD='BDA'
    AND NOT EXISTS (SELECT agency_id
    FROM TBL_BDA_AGENCY_RESP_REP t
    WHERE t.ISS_GRP_ID IN ('%')
    AND t.AGENCY_ID = C.AGENCY_ID)
    AND K.ATTRIBUTE_VALUE LIKE '%'
    AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
    AND (to_char(NVL(B.PROFILE_ID,0)) LIKE '%' OR NVL(B.PROFILE_ID,0) IN ('a'))
    AND NVL(G.OFFICE_ID,0) IN ('%')
    AND (to_char(NVL(C.RESP_USR_ID,'0')) LIKE '%' OR NVL(C.RESP_USR_ID,'0') IN ('k'))
    ORDER BY PROFILE_NM
    The number of rows in these tables are as follows:
    PROFILE_PORTAL -- 2392
    TBL_BDA_AGENCY_RESP_REP 3508
    TBL_BDA_AGENCY_OFFICE 2151
    TBL_BDA_OFFICE 3
    USERS_PORTAL 270500
    TBL_BDA_USR_ISS_GRP 234
    TBL_BDA_ISS_GROUP 2
    ATTRIBUTE_VALUES_PORTAL 2790
    PROFILE_TYPE_PORTAL 3
    The Explain pal nhas given this o/p to me:
    SQL> select * from table(dbms_xplan.display) dual;
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
    | 0 | SELECT STATEMENT | | 807 | 102K| | 2533 |
    | 1 | SORT UNIQUE | | 807 | 102K| 232K| 82 |
    |* 2 | FILTER | | | | | |
    |* 3 | HASH JOIN OUTER | | 807 | 102K| | 52 |
    |* 4 | HASH JOIN OUTER | | 807 | 95226 | | 40 |
    |* 5 | TABLE ACCESS BY INDEX ROWID | ATTRIBUTE_VALUES | 1 | 23 | | 2 |
    | 6 | NESTED LOOPS | | 7 | 805 | | 37 |
    | 7 | NESTED LOOPS OUTER | | 6 | 552 | | 25 |
    |* 8 | FILTER | | | | | |
    | 9 | NESTED LOOPS OUTER | | | | | |
    |* 10 | FILTER | | | | | |
    | 11 | NESTED LOOPS OUTER | | | | | |
    | 12 | NESTED LOOPS OUTER | | 3 | 141 | | 10 |
    |* 13 | HASH JOIN | | 3 | 120 | | 7 |
    |* 14 | TABLE ACCESS FULL | PROFILE | 6 | 198 | | 4 |
    |* 15 | TABLE ACCESS FULL | PROFILE_TYPE | 1 | 7 | | 2 |
    |* 16 | INDEX RANGE SCAN | SYS_C0019777 | 1 | 7 | | 1 |
    | 17 | TABLE ACCESS BY INDEX ROWID| TBL_BDA_OFFICE | 1 | 10 | | 1 |
    |* 18 | INDEX UNIQUE SCAN | SYS_C0019800 | 1 | | | |
    | 19 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 2 | 26 | | 2 |
    |* 20 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
    | 21 | TABLE ACCESS BY INDEX ROWID | USER_ | 1 | 22 | | 1 |
    |* 22 | INDEX UNIQUE SCAN | USER_PK | 1 | | | |
    |* 23 | INDEX RANGE SCAN | IDX_ATTVAL_ENTATTID | 1 | | | 1 |
    | 24 | TABLE ACCESS FULL | TBL_BDA_USR_ISS_GRP | 234 | 702 | | 2 |
    | 25 | TABLE ACCESS FULL | TBL_BDA_ISS_GROUP | 2 | 24 | | 2 |
    |* 26 | TABLE ACCESS BY INDEX ROWID | TBL_BDA_AGENCY_RESP_REP | 1 | 7 | | 3 |
    |* 27 | INDEX RANGE SCAN | IDX_AGECYRESP_AGNCYID | 2 | | | 1 |
    Predicate Information (identified by operation id):
    2 - filter( NOT EXISTS (SELECT /*+ */ 0 FROM "TBL_BDA_AGENCY_RESP_REP" "T" WHERE "T"."AGENCY_ID"=:B1
    AND "T"."ISS_GRP_ID"=TO_NUMBER('%')))
    3 - access("I"."ISS_GRP_ID"="J"."ISS_GRP_ID"(+))
    4 - access("SYS_ALIAS_1"."ISS_GRP_ID"="I"."ISS_GRP_ID"(+))
    5 - filter("K"."ATTRIBUTE_VALUE" IS NOT NULL AND "K"."ATTRIBUTE_VALUE" LIKE '%')
    8 - filter(NVL("SYS_ALIAS_1"."RESP_USR_ID",'0') LIKE '%' OR NVL("SYS_ALIAS_1"."RESP_USR_ID",'0')='k')
    10 - filter(NVL("G"."OFFICE_ID",0)=TO_NUMBER('%'))
    13 - access("L"."PROFILE_TYPE_ID"="B"."PROFILE_TYPE_ID")
    14 - filter(UPPER("B"."PROFILE_NM") LIKE '%' AND (TO_CHAR(NVL("B"."PROFILE_ID",0)) LIKE '%' OR
    NVL("B"."PROFILE_ID",0)=TO_NUMBER('a')))
    15 - filter("L"."APPLICATION_CD"='BDA')
    16 - access("B"."PROFILE_ID"="F"."AGENCY_ID"(+))
    18 - access("G"."OFFICE_ID"(+)="F"."OFFICE_ID")
    20 - access("B"."PROFILE_ID"="SYS_ALIAS_1"."AGENCY_ID"(+))
    22 - access("H"."USERID"(+)="SYS_ALIAS_1"."RESP_USR_ID")
    23 - access("K"."ENTITY_ID"='PROFILE.'||TO_CHAR("B"."PROFILE_ID"))
    26 - filter("T"."ISS_GRP_ID"=TO_NUMBER('%'))
    27 - access("T"."AGENCY_ID"=:B1)
    Note: cpu costing is off
    57 rows selected.
    Elapsed: 00:00:01.08
    Please help me.
    Aashish S.

    Hello Eric,
    Here is the code:
    SELECT DISTINCT
    K.ATTRIBUTE_VALUE AGENCY_ID,
    B.PROFILE_NM ,
    NVL(G.OFFICE_DESC,'--') OFFICE_DESC,
    f.OFFICE_ID,
    B.PROFILE_ID,
    '%' ROLE,
    '%' LAYOUT,
    case
    WHEN 'flagB' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING')
    WHEN 'flagO' = '%' THEN
    NVL(J.ISS_GRP_DESC,'ORDERING')
    WHEN 'flag' = '%' THEN
    NVL(J.ISS_GRP_DESC,'BILLING/ORDERING')
    else
    NVL(J.ISS_GRP_DESC,' ')
    END ISS_GRP_DESC,
    DECODE(NVL(H.USERID,' ') ,' ','--','&lt;a sbcuid_in=' || H.USERID || ' target=NEW &gt;'||H.FIRSTNAME || ' ' || H.LASTNAME ||
    '( ' || H.USERID || ' )&lt;/a&gt;' ) USER_NAME
    from
    PROFILE_PORTAL B ,
    TBL_BDA_AGENCY_RESP_REP C ,
    TBL_BDA_AGENCY_OFFICE F,
    TBL_BDA_OFFICE G,
    USERS_PORTAL H,
    TBL_BDA_USR_ISS_GRP I ,
    TBL_BDA_ISS_GROUP J,
    ATTRIBUTE_VALUES_PORTAL K,
    PROFILE_TYPE_PORTAL L
    WHERE
    B.PROFILE_ID = F.AGENCY_ID (+)
    AND B.PROFILE_ID = C.AGENCY_ID (+)
    AND G.OFFICE_ID (+)= F.OFFICE_ID
    AND H.USERID (+)= C.RESP_USR_ID
    AND C.ISS_GRP_ID = I.ISS_GRP_ID (+)
    AND I.ISS_GRP_ID = J.ISS_GRP_ID(+)
    AND 'PROFILE.'||B.PROFILE_ID = K.ENTITY_ID(+)
    AND K.ATTRIBUTE_VALUE IS NOT NULL
    AND L.PROFILE_TYPE_ID = B.PROFILE_TYPE_ID
    AND L.APPLICATION_CD='BDA'
    AND NOT EXISTS
    (SELECT agency_id
    FROM TBL_BDA_AGENCY_RESP_REP t
    WHERE t.ISS_GRP_ID IN (1)
    AND t.AGENCY_ID = C.AGENCY_ID)
    AND K.ATTRIBUTE_VALUE LIKE '%'
    AND UPPER(B.PROFILE_NM) LIKE UPPER('%')
    AND (to_char(NVL(B.PROFILE_ID,0))
    LIKE '%'
    OR NVL(B.PROFILE_ID,0) IN (1))
    AND NVL(G.OFFICE_ID,0) IN (1)
    AND (to_char(NVL(C.RESP_USR_ID,'0'))
    LIKE '%'
    OR NVL(C.RESP_USR_ID,'0') IN ('%'))
    ORDER BY PROFILE_NM
    This is the Query and the query takes some mins. to run in prod environment.
    From the Query plan ,I am not able to get any idea for optimization.
    Now,Can you tell me which steps I need to follow to run it faster and which all modifications should be made?
    Thanks.
    Aashish S.

  • Need help for performance tunning

    Hello,
    I have 16K records return by query, it takes long time to proceed for 7K it takes 7.5 sec.
    Note: I used all seeded tables only.
    If possible please help me to tune it.
    SELECT       msi.inventory_item_id,msi.segment1,msi.rimary_uom_code , msi.primary_unit_of_measure
    FROM  mtl_system_items_b msi, qp_list_lines qpll,qp_pricing_attributes qppr,
              mtl_category_sets_tl mcs,mtl_category_sets_b mcsb,
              mtl_categories_b mc, mtl_item_categories mcb
    WHERE     msi.enabled_flag = 'Y'
         AND qpll.list_line_id = qppr.list_line_id
         AND qppr.product_attr_value = TO_CHAR (msi.inventory_item_id(+))
         AND qppr.product_uom_code = msi.primary_uom_code
         AND mc.category_id = mcb.category_id
         AND msi.inventory_item_id = mcb.inventory_item_id
         AND msi.organization_id = mcb.organization_id
         AND TRUNC (SYSDATE) BETWEEN NVL (qpll.start_date_active,TRUNC (SYSDATE)) AND NVL (qpll.end_date_active,TRUNC (SYSDATE))
         AND mcs.category_set_name = 'LSS SALES CATEGORY'
         AND mcs.language = 'US'
         AND mcs.category_set_id = mcsb.category_set_id
         AND mcsb.structure_id = mc.structure_id
         AND msi.organization_id = :p_organization_id
         AND qpll.list_header_id = :p_price_list_id
         AND mcb.category_id = :p_category_id;
    Thanks and regards
    Akil.

    Thanks Helios ,
    here is answers
    Databse version
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit  
    PL/SQL Release 11.1.0.7.0
    explain plan
    | Id  | Operation                       | Name                     | Rows  | Bytes | Cost (%CPU)|

    0 | SELECT STATEMENT              
    |                          |   
    1 |   149 |  9439 
    (1)|

    1 |  NESTED LOOPS                   |                          |     1 | 
    149 |  9439   (1)|
    |*
    2 |   HASH JOIN OUTER               |                          |     1 | 
    135 |  9437   (1)|
    |*
    3 |    HASH JOIN                    |                          |     1 |  
    71 |  9432   (1)|

    4 |     NESTED LOOPS                |                          |     2 |  
    76 |    53   (0)|
    |*
    5 |      TABLE ACCESS BY INDEX
    ROWID| QP_LIST_LINES            |     2 |  
    44 |    49   (0)|
    |*
    6 |       INDEX SKIP SCAN           | QP_LIST_LINES_N2         | 
    702 |       |    20 
    (0)|
    |*
    7 |      INDEX RANGE SCAN           | QP_PRICING_ATTRIBUTES_N3 |     1 |  
    16 |     2   (0)|
    |*
    8 |     TABLE ACCESS BY INDEX
    ROWID | MTL_SYSTEM_ITEMS_B       | 46254
    |  1490K|
    9378   (1)|
    |*
    9 |      INDEX RANGE SCAN           | MTL_SYSTEM_ITEMS_B_N9    | 46254 |       | 
    174   (1)|
    |
    10 |    TABLE ACCESS FULL            | XX_WEB_ITEM_IMAGE_TBL    | 
    277 | 17728 |     5   (0)|
    |* 11 |   INDEX RANGE SCAN              | MTL_ITEM_CATEGORIES_U1   |   
    1 |    14 |     2 
    (0)|
    Predicate Information (identified
    by operation id):
    2 -
    access("XWIIT"."IMAGE_CODE"(+)="MSI"."SEGMENT1")
    3 -
    access("QPPR"."PRODUCT_ATTR_VALUE"=TO_CHAR("MSI"."INVENTORY_ITEM_ID")
    AND
    "QPPR"."PRODUCT_UOM_CODE"="MSI"."PRIMARY_UOM_CODE")
    5 - filter(NVL("QPLL"."START_DATE_ACTIVE",TRUNC(SYSDATE@!))<=TRUNC(SYSDATE@!)
    AND
    NVL("QPLL"."END_DATE_ACTIVE",TRUNC(SYSDATE@!))>=TRUNC(SYSDATE@!))
    6 -
    access("QPLL"."LIST_HEADER_ID"=TO_NUMBER(:P_PRICE_LIST_ID))
    filter("QPLL"."LIST_HEADER_ID"=TO_NUMBER(:P_PRICE_LIST_ID))
    7 -
    access("QPLL"."LIST_LINE_ID"="QPPR"."LIST_LINE_ID")
    filter("QPPR"."PRODUCT_UOM_CODE" IS NOT NULL)
    8 - filter("MSI"."ENABLED_FLAG"='Y')
    9 - access("MSI"."ORGANIZATION_ID"=TO_NUMBER(:P_ORGANIZATION_ID))
    11 -
    access("MCB"."ORGANIZATION_ID"=TO_NUMBER(:P_ORGANIZATION_ID)
    AND
    "MSI"."INVENTORY_ITEM_ID"="MCB"."INVENTORY_ITEM_ID"
    AND
    "MCB"."CATEGORY_ID"=TO_NUMBER(:P_CATEGORY_ID))
           filter("MCB"."CATEGORY_ID"=TO_NUMBER(:P_CATEGORY_ID))
    Note
    - 'PLAN_TABLE' is old version
    TKprof Plan
    TKPROF: Release 11.1.0.7.0 - Production on Fri Nov 15 06:12:26 2013
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: LSSD_ora_19760.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 msi.inventory_item_id,
           msi.segment1,
           primary_uom_code,
           primary_unit_of_measure,
           xwiit.image_url
      FROM mtl_system_items_b msi,
           qp_list_lines qpll,
           qp_pricing_attributes qppr,
           mtl_item_categories mcb,
           xx_web_item_image_tbl xwiit
    WHERE     msi.enabled_flag = 'Y'
           AND qpll.list_line_id = qppr.list_line_id
           AND qppr.product_attr_value = TO_CHAR (msi.inventory_item_id)
           AND qppr.product_uom_code = msi.primary_uom_code
           AND msi.inventory_item_id = mcb.inventory_item_id
           AND msi.organization_id = mcb.organization_id
           AND TRUNC (SYSDATE) BETWEEN NVL (qpll.start_date_active,
                                            TRUNC (SYSDATE))
                                   AND NVL (qpll.end_date_active,
                                            TRUNC (SYSDATE))
           AND xwiit.image_code(+) = msi.segment1
           AND msi.organization_id = :p_organization_id
           AND qpll.list_header_id = :p_price_list_id
           AND mcb.category_id = :p_category_id
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        2      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch        2      3.84       3.85          0     432560          0        1002
    total        6      3.84       3.85          0     432560          0        1002
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 
    Rows     Row Source Operation
        501  NESTED LOOPS  (cr=216280 pr=0 pw=0 time=115 us cost=9439 size=149 card=1)
       2616   HASH JOIN OUTER (cr=211012 pr=0 pw=0 time=39 us cost=9437 size=135 card=1)
      78568    HASH JOIN  (cr=210997 pr=0 pw=0 time=3786 us cost=9432 size=71 card=1)
      78571     NESTED LOOPS  (cr=29229 pr=0 pw=0 time=35533 us cost=53 size=76 card=2)
      78571      TABLE ACCESS BY INDEX ROWID QP_LIST_LINES (cr=9943 pr=0 pw=0 time=27533 us cost=49 size=44 card=2)
    226733       INDEX SKIP SCAN QP_LIST_LINES_N2 (cr=865 pr=0 pw=0 time=4122 us cost=20 size=0 card=702)(object id 99730)
      78571      INDEX RANGE SCAN QP_PRICING_ATTRIBUTES_N3 (cr=19286 pr=0 pw=0 time=0 us cost=2 size=16 card=1)(object id 99733)
    128857     TABLE ACCESS BY INDEX ROWID MTL_SYSTEM_ITEMS_B (cr=181768 pr=0 pw=0 time=9580 us cost=9378 size=1526382 card=46254)
    128857      INDEX RANGE SCAN MTL_SYSTEM_ITEMS_B_N9 (cr=450 pr=0 pw=0 time=1657 us cost=174 size=0 card=46254)(object id 199728)
        277    TABLE ACCESS FULL XX_WEB_ITEM_IMAGE_TBL (cr=15 pr=0 pw=0 time=22 us cost=5 size=17728 card=277)
        501   INDEX RANGE SCAN MTL_ITEM_CATEGORIES_U1 (cr=5268 pr=0 pw=0 time=0 us cost=2 size=14 card=1)(object id 99557)
    Note: I modified query and it gives good result, now it takes 3 to 4 sec for 16000 records.
    If possible can you plz explain what we have to take care while doing performance tunning
    I am a fresher so don't have that much idea.
    and also Thanks Hussein for your replay

  • Please help me to tune this PL/SQL...

    Hi everyone,
        I have a SQL query which runs ok when i run it individually but the same query if
    i use it in a procedure.The procedure is hanging up.Could someone please help to tune this
    SQL query and please check my procedure why is it hanging up.
    SQL Query
    =========
    SELECT active_members.member_nbr,
      active_members.name_last,
      active_members.name_first,
      active_members.name_middle,
      active_members.dob,
      active_members.sex,
      active_members.subsciber_nbr,
      active_members.ssn,
      active_members.name_suffix,
      active_members.class_x,
      active_members.aff_nbr,
    CASE
    WHEN TRIM(active_members.class_x) = 'SE' THEN
        (SELECT DISTINCT(mssp.member_nbr)
         FROM member_span mssp
         WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
         AND mssp.class_x = 'SP'
         AND rownum = 1)
       WHEN TRIM(active_members.class_x) = 'SP' THEN
          (SELECT DISTINCT(mssp.member_nbr)
           FROM member_span mssp
           WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
           AND mssp.class_x = 'SE'
           AND rownum = 1)
      ELSE
        NULL
       END)
    spouse_member_nbr,
      active_members.division_nbr,
      active_members.ymdeff,
      active_members.ymdend,
      active_members.actual_ymd_enddt,
      active_members.email_id,
      active_members.network_id,
      active_members.insurance_company_code,
      active_members.cob_flag,
      active_members.vip_flag,
      active_members.pre_x_flag,
      active_members.region,
      active_contracts.language_x,
      active_contracts.corp_nbr,
      active_members.group_nbr,
      active_members.non_erisa_status
    FROM
      (SELECT mb_active.member_nbr,
         mb_active.contract_nbr,
         mb_active.name_last,
         mb_active.name_first,
         mb_active.name_middle,
         ms_active.ymdeff,
         ms_active.ymdend,
         to_char(to_date(
       CASE
       WHEN LENGTH(mb_active.ymdbirth) = 8 THEN mb_active.ymdbirth
       ELSE NULL
       END,    'YYYYMMDD'),    'MM/DD/YYYY') dob,
         mb_active.sex,
         to_char(to_date(ms_active.ymdeff,    'YYYYMMDD'),    'MM/DD/YYYY') ymdeff_formatted,
         to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY') ymdend_formatted,
         ms_active.void,
       CASE
       WHEN SUBSTR(mb_active.member_nbr,    10,    2) = '00' THEN mb_active.member_nbr
       ELSE SUBSTR(mb_active.member_nbr,    1,    9) || '00'
       END) subsciber_nbr,
         mb_active.ssn,
         mb_active.name_suffix,
         ms_active.class_x,
         ms_active.aff_nbr,
         ms_active.division_nbr,
       CASE
       WHEN TRIM(ms_active.ymdend) = '99991231' THEN NULL
       ELSE to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY')
       END) actual_ymd_enddt,
       CASE
       WHEN TRIM(ms_active.business_unit) = '01' THEN ms_active.business_unit || '-' || ms_active.prog_nbr
       WHEN TRIM(ms_active.business_unit) = '03' THEN ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier
       ELSE NULL
       END) network_id,
         ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier insurance_company_code,
          (SELECT DISTINCT(email)
         FROM dbo.av_mem_email
         WHERE dbo.av_mem_email.member_nbr = mb_active.member_nbr
         AND rownum = 1)
      email_id,
         mb_active.lr_response cob_flag,
         mb_active.record_nbr vip_flag,
         ms_active.pre_exist pre_x_flag,
         ms_active.region region,
         ms_active.group_nbr,
       CASE
       WHEN
        (SELECT TRIM(div.div_status)
         FROM division div
         WHERE TRIM(div.division_nbr) = TRIM(ms_active.division_nbr)) = 'NULL' THEN
          'Y'
         ELSE
          'N'
         END)
      non_erisa_status
       FROM member mb_active,
         member_span ms_active
       WHERE mb_active.member_nbr = ms_active.member_nbr
       AND(20090707 BETWEEN ms_active.ymdeff
       AND ms_active.ymdend
       AND TRIM(ms_active.void) IS NULL
    active_members,
        (SELECT DISTINCT(contract.contract_nbr),
         contract.language_x,
         contract_span.corp_nbr
       FROM contract,
         contract_span
       WHERE contract.contract_nbr = contract_span.contract_nbr
       AND(20090707 BETWEEN contract_span.ymdeff
       AND contract_span.ymdend)
       AND TRIM(contract_span.void) IS
      NULL)
    active_contracts
    WHERE TRIM(active_members.contract_nbr) = TRIM(active_contracts.contract_nbr);
    Taking around 6 minute to run and it returns """"268267"""" records
    Explain Plan for the above SQL:
    ===============================
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 379550299"
    "| Id  | Operation                      | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | SELECT STATEMENT               |               |  2609K|   659M|       | 91679   (3)| 00:18:21 |"
    "|   1 |  HASH UNIQUE                   |               |     1 |    16 |       | 54461   (2)| 00:10:54 |"
    "|*  2 |   COUNT STOPKEY                |               |       |       |       |            |          |"
    "|*  3 |    TABLE ACCESS FULL           | MEMBER_SPAN   | 12891 |   201K|       | 54459   (2)| 00:10:54 |"
    "|   4 |    HASH UNIQUE                 |               |     1 |    16 |  2424K| 54736   (2)| 00:10:57 |"
    "|*  5 |     COUNT STOPKEY              |               |       |       |       |            |          |"
    "|*  6 |      TABLE ACCESS FULL         | MEMBER_SPAN   | 51541 |   805K|       | 54459   (2)| 00:10:54 |"
    "|   7 |  HASH UNIQUE                   |               |     1 |    50 |       |    64   (4)| 00:00:01 |"
    "|*  8 |   COUNT STOPKEY                |               |       |       |       |            |          |"
    "|*  9 |    TABLE ACCESS FULL           | AV_MEM_EMAIL  |     1 |    50 |       |    63   (2)| 00:00:01 |"
    "|* 10 |  TABLE ACCESS FULL             | DIVISION      |     1 |    14 |       |     3   (0)| 00:00:01 |"
    "|* 11 |  HASH JOIN                     |               |  2609K|   659M|       | 91679   (3)| 00:18:21 |"
    "|  12 |   VIEW                         |               |   581 | 12782 |       |  8184   (4)| 00:01:39 |"
    "|  13 |    HASH UNIQUE                 |               |   581 | 26145 |       |  8184   (4)| 00:01:39 |"
    "|  14 |     TABLE ACCESS BY INDEX ROWID| CONTRACT      |     1 |    14 |       |     2   (0)| 00:00:01 |"
    "|  15 |      NESTED LOOPS              |               |   581 | 26145 |       |  8183   (4)| 00:01:39 |"
    "|* 16 |       TABLE ACCESS FULL        | CONTRACT_SPAN |   581 | 18011 |       |  7019   (5)| 00:01:25 |"
    "|* 17 |       INDEX RANGE SCAN         | CONTRACT_IX1  |     1 |       |       |     1   (0)| 00:00:01 |"
    "|* 18 |   HASH JOIN                    |               |   449K|   104M|    39M| 83466   (2)| 00:16:42 |"
    "|* 19 |    TABLE ACCESS FULL           | MEMBER_SPAN   |   449K|    34M|       | 54964   (3)| 00:11:00 |"
    "|  20 |    TABLE ACCESS FULL           | MEMBER        |  1436K|   221M|       | 14664   (2)| 00:02:56 |"
    "Predicate Information (identified by operation id):"
    "   2 - filter(ROWNUM=1)"
    "   3 - filter(SUBSTR("MSSP"."MEMBER_NBR",1,9)=SUBSTR(:B1,1,9) AND "MSSP"."CLASS_X"='SP')"
    "   5 - filter(ROWNUM=1)"
    "   6 - filter(SUBSTR("MSSP"."MEMBER_NBR",1,9)=SUBSTR(:B1,1,9) AND "MSSP"."CLASS_X"='SE')"
    "   8 - filter(ROWNUM=1)"
    "   9 - filter("AV_MEM_EMAIL"."MEMBER_NBR"=:B1)"
    "  10 - filter(TRIM("DIV"."DIVISION_NBR")=TRIM(:B1))"
    "  11 - access(TRIM("MB_ACTIVE"."CONTRACT_NBR")=TRIM("ACTIVE_CONTRACTS"."CONTRACT_NBR"))"
    "  16 - filter("CONTRACT_SPAN"."YMDEFF"<=20090707 AND TRIM("CONTRACT_SPAN"."VOID") IS NULL AND "
    "              "CONTRACT_SPAN"."YMDEND">=20090707)"
    "  17 - access("CONTRACT"."CONTRACT_NBR"="CONTRACT_SPAN"."CONTRACT_NBR")"
    "  18 - access("MB_ACTIVE"."MEMBER_NBR"="MS_ACTIVE"."MEMBER_NBR")"
    "  19 - filter(TRIM("MS_ACTIVE"."VOID") IS NULL AND "MS_ACTIVE"."YMDEFF"<=20090707 AND "
    "              "MS_ACTIVE"."YMDEND">=20090707)"
    SAME SQL IN A PROCEDURE..IT IS HANGING UP
    ========================================
    create or replace PROCEDURE TEST_CURRENT_PCP_SPAN is
    EXTRACTED_STRING VARCHAR2(32767);
    FILEHANDLER UTL_FILE.FILE_TYPE;
    test_str varchar2(100);
    pcp_eff_date number(10);
    file_name varchar2(50);
       CURSOR MEMBERS
       IS
    SELECT active_members.member_nbr,
      active_members.name_last,
      active_members.name_first,
      active_members.name_middle,
      active_members.dob,
      active_members.sex,
      active_members.subsciber_nbr,
      active_members.ssn,
      active_members.name_suffix,
      active_members.class_x,
      active_members.aff_nbr,
    CASE
    WHEN TRIM(active_members.class_x) = 'SE' THEN
        (SELECT DISTINCT(mssp.member_nbr)
         FROM member_span mssp
         WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
         AND mssp.class_x = 'SP'
         AND rownum = 1)
       WHEN TRIM(active_members.class_x) = 'SP' THEN
          (SELECT DISTINCT(mssp.member_nbr)
           FROM member_span mssp
           WHERE SUBSTR(mssp.member_nbr,    1,    9) = SUBSTR(active_members.member_nbr,    1,    9)
           AND mssp.class_x = 'SE'
           AND rownum = 1)
      ELSE
        NULL
       END)
    spouse_member_nbr,
      active_members.division_nbr,
      active_members.ymdeff,
      active_members.ymdend,
      active_members.actual_ymd_enddt,
      active_members.email_id,
      active_members.network_id,
      active_members.insurance_company_code,
      active_members.cob_flag,
      active_members.vip_flag,
      active_members.pre_x_flag,
      active_members.region,
      active_contracts.language_x,
      active_contracts.corp_nbr,
      active_members.group_nbr,
      active_members.non_erisa_status
    FROM
      (SELECT mb_active.member_nbr,
         mb_active.contract_nbr,
         mb_active.name_last,
         mb_active.name_first,
         mb_active.name_middle,
         ms_active.ymdeff,
         ms_active.ymdend,
         to_char(to_date(
       CASE
       WHEN LENGTH(mb_active.ymdbirth) = 8 THEN mb_active.ymdbirth
       ELSE NULL
       END,    'YYYYMMDD'),    'MM/DD/YYYY') dob,
         mb_active.sex,
         to_char(to_date(ms_active.ymdeff,    'YYYYMMDD'),    'MM/DD/YYYY') ymdeff_formatted,
         to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY') ymdend_formatted,
         ms_active.void,
       CASE
       WHEN SUBSTR(mb_active.member_nbr,    10,    2) = '00' THEN mb_active.member_nbr
       ELSE SUBSTR(mb_active.member_nbr,    1,    9) || '00'
       END) subsciber_nbr,
         mb_active.ssn,
         mb_active.name_suffix,
         ms_active.class_x,
         ms_active.aff_nbr,
         ms_active.division_nbr,
       CASE
       WHEN TRIM(ms_active.ymdend) = '99991231' THEN NULL
       ELSE to_char(to_date(ms_active.ymdend,    'YYYYMMDD'),    'MM/DD/YYYY')
       END) actual_ymd_enddt,
       CASE
       WHEN TRIM(ms_active.business_unit) = '01' THEN ms_active.business_unit || '-' || ms_active.prog_nbr
       WHEN TRIM(ms_active.business_unit) = '03' THEN ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier
       ELSE NULL
       END) network_id,
         ms_active.business_unit || '-' || ms_active.prog_nbr || '-' || ms_active.carrier insurance_company_code,
          (SELECT DISTINCT(email)
         FROM dbo.av_mem_email
         WHERE dbo.av_mem_email.member_nbr = mb_active.member_nbr
         AND rownum = 1)
      email_id,
         mb_active.lr_response cob_flag,
         mb_active.record_nbr vip_flag,
         ms_active.pre_exist pre_x_flag,
         ms_active.region region,
         ms_active.group_nbr,
       CASE
       WHEN
        (SELECT TRIM(div.div_status)
         FROM division div
         WHERE TRIM(div.division_nbr) = TRIM(ms_active.division_nbr)) = 'NULL' THEN
          'Y'
         ELSE
          'N'
         END)
      non_erisa_status
       FROM member mb_active,
         member_span ms_active
       WHERE mb_active.member_nbr = ms_active.member_nbr
       AND(20090707 BETWEEN ms_active.ymdeff
       AND ms_active.ymdend
       AND TRIM(ms_active.void) IS NULL
    active_members,
        (SELECT DISTINCT(contract.contract_nbr),
         contract.language_x,
         contract_span.corp_nbr
       FROM contract,
         contract_span
       WHERE contract.contract_nbr = contract_span.contract_nbr
       AND(20090707 BETWEEN contract_span.ymdeff
       AND contract_span.ymdend)
       AND TRIM(contract_span.void) IS
      NULL)
    active_contracts
    WHERE TRIM(active_members.contract_nbr) = TRIM(active_contracts.contract_nbr);
      TYPE MEM IS TABLE OF MEMBERS%ROWTYPE INDEX BY PLS_INTEGER;
      TABLE_MEM MEM;
    MEMBER_ADDR   MGONZALEZ.CPKG_UTIL.ADDR;
    BEGIN 
       test_str := '''A10000213'''||','||'''A10000213''';
       insert into test_number_char(str) values ('start time of MEMBER_LOAD_CURRENT_PCP_SPAN '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       file_name := 'member_load'||to_char(sysdate,'YYYYMMDDHH24MI')||'.txt';
       FILEHANDLER := UTL_FILE.FOPEN('AVMED_UTL_FILE',file_name, 'W',10000);
       insert into test_number_char(str) values ('start time of opening members cursor(before open members command) '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       OPEN MEMBERS;
    LOOP
          FETCH MEMBERS
             BULK COLLECT INTO TABLE_MEM LIMIT 1000 ;
           EXIT WHEN TABLE_MEM.COUNT = 0;
    insert into test_number_char(str) values ('start time of outer loop '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
          FOR i IN 1 .. TABLE_MEM.COUNT
          LOOP
          EXTRACTED_STRING := TRIM(TABLE_MEM(i).MEMBER_NBR)||'| '||     
                              TRIM(TABLE_MEM(i).NAME_LAST)||'| '||      
                            TRIM(TABLE_MEM(i).NAME_FIRST)||'| '||      
                             TRIM(TABLE_MEM(i).NAME_MIDDLE)||'| '||   
                             TRIM(TABLE_MEM(i).ssn)||'| '||            
                             TABLE_MEM(i).subsciber_nbr||'| '||        
                             TRIM(TABLE_MEM(i).class_x)||'| '||         
                             TRIM(TABLE_MEM(i).DOB)||'| '||             
                             TRIM(TABLE_MEM(i).SEX)||'| ' ;             
              EXTRACTED_STRING   :=
                    EXTRACTED_STRING ||
                  TRIM(TABLE_MEM(i).aff_nbr)||'| '||                         
                                pcp_eff_date||'| '||                 
              TABLE_MEM(i).actual_ymd_enddt||'| '||                        
                  TRIM(TABLE_MEM(i).division_nbr)||'| '||                    
                  ' '||'| '||                                               
                  ' '||'| '||                                                  
                  ' '||'| '||                                                 
                  TABLE_MEM(i).network_id||'| '||                              
                  ' '||'| '||                                                  
                  ' '||'| '||                                                  
                  ' '||'| '||                                                  
                  ' '||'| '||                                                 
                  ' '||'| '||                                                  
                 TRIM(TABLE_MEM(i).name_suffix)||'| '||                       
                 ' '||'| '||                                                   
                 TRIM(TABLE_MEM(i).spouse_member_nbr)||'| '||                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                   
                 ' '||'| '||                                                  
                 ' '||'| '||                                                   
                TRIM(TABLE_MEM(i).email_id)||'| '||                                
                TABLE_MEM(i).Insurance_company_code||'| '||                    
                TABLE_MEM(i).group_nbr||'| '||                                 
                TABLE_MEM(i).language_x||'| '||                               
                TABLE_MEM(i).region||'| '||                                    
                TABLE_MEM(i).corp_nbr||'| '||                                  
                TABLE_MEM(i).non_erisa_status||'| '||                          
                TABLE_MEM(i).cob_flag||'| '||                                  
                TABLE_MEM(i).pre_x_flag||'| '||                                
                TABLE_MEM(i).vip_flag                                       
                 EXTRACTED_STRING   := rtrim(EXTRACTED_STRING,' ');
            UTL_FILE.PUT_LINE(FILEHANDLER,EXTRACTED_STRING,TRUE);
            EXTRACTED_STRING := NULL;
            pcp_eff_date := NULL;
          END LOOP;
          insert into test_number_char(str) values ('end time of outer loop '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
    END LOOP;
    close members;
    insert into test_number_char(str) values ('end time of opening members cursor '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
    commit;
    commit;
       UTL_FILE.FCLOSE(FILEHANDLER);
       insert into test_number_char(str) values ('End time of MEMBER_LOAD_CURRENT_PCP_SPAN '||to_char(sysdate,'MM/DD/YYYY HH24:MI:SS'));
       commit;
       EXCEPTION
          WHEN OTHERS
          THEN
             DBMS_OUTPUT.put_line(   'ERROR getting members '
                                  || SQLCODE
                                  || ' '
                                  || SQLERRM);
    END ;
    In my Test table which i am inserting to check the times...
    I am geting on these 2 records after that it hangs up...
    start time of MEMBER_LOAD_CURRENT_PCP_SPAN 07/08/2009 11:41:21
    start time of opening members cursor(before open members command) 07/08/2009 11:41:21I have to call some other functions for each member to get additional details thats the reason i am going for Procedure.Instead it is just a simple SQL
    Thanks in advance

    It is taking lot of timeYou could perhaps split it up in smaller, isolated parts.
    Running certain steps separate.
    ..is it possible to find out the issues without running the proc?Other than have other people on OTN give their ideas/share experiences?
    Not that I'm aware of.
    There are lots of statistical views, you might be able to deduct from their data, but I personally prefer running the procedure and just trace it. But I'm always willing to learn new approaches, btw.
    Still, you have 2 things to look at, at least:
    - avoid loops in loops if possible
    - check your predicates, if you apply a function, you lose the index, unless you create a function based index.
    edit
    One more thing (how could I overlook that):
    You commit your instrumentation code ( insert into test_number_char(str) ) IN the loop.
    Please remove commit in your loops...
    Commit only once, at the end of your transaction.
    Never commit in a loop.
    (Preferrably the client commits)
    And remove every commit in your loop...
    Edited by: hoek on Jul 8, 2009 8:03 PM

  • Help with i Tunes

    I wanted to go on to my i Tunes and add more music. When I try to open i Tunes, I get a message that says: The file "i Tunes Library .itl" cannot be read because it was created by a newer version of i Tunes. HELP!!! I need to be able to add music!

    One way is to download the latest iTunes from Apple and then point the latest version to your i Tunes Library .itl location.
    However there seems to be a lot of syncing and deleted files problems, when using the latest iTunes with the iPod Classic.
    I would prefer to use your current iTunes, if it is not giving any problem with your iPod Classic.
    1. Click the File menu
    2. Select Add Folder to Library
    this will show you where your music files are supposed to be. ( either in iTunes Music or iTunes Media )
    3. Click OK
    and wait for 20 minutes or so while iTunes generate a new library file.
    Good luck.

  • Help, wrong i- tunes library. Most recent one is gone.

    Help! I opened i tunes one day and it asked me to select a library. Thinking that I didn't want to create a new one, i decided to choose one. It said previous i- tunes library. I chose the one that was last month's but somehow, my most recent library has been lost. All of my recent purchases too. Any suggestions on how to fix it?

    This JUST happened to me! Were you able to solve the problem?

  • Laptop crash with i tunes library. Have recently sync with my work mac but I am missing all my old songs.  Please help.   I tunes novice.

    My laptop  crashed with mine and my husbands I tunes Library.  I have sync my i phone with my work mac but I am still missing some of my songs.
    My husband was unable to do this as his i phone broke too and he has no music at all. 
    Please help.

    Apple devices are designed to sync with a single library. If you move the device to a new library iTunes will suggest wiping the device and reloading it with the contents of the library on the new computer, even if most of the content is identical. For an iOS device this process would also delete and reinstall any applications which would discard and settings or saved data associated with the apps. You probably don't want to do this.
    Ideally you would have migrate the working library from the computer previously used to manage the device (the laptop) to the computer you now want to use (the desktop) before adding other new content into the new computer's library. That way the device would have easily moved from syncing with one machine to the other.
    I'm not quite sure what the best next step is at this point. Does the desktop library sync with any other devices?
    tt2

  • HELP PLEASE, NOKIA TUNE FOR 3310

    Hi. I have a Nokia 3310, and i want to compose the ringtone from movie Crank, that special Nokia Tune. can someone help me please ?

    Sorry, I can't. I have tried to google it for quite a while but not found it. I don't think I will spend my sunday evening trying to figure out how to make that song.
    From the youtube video, it sounds like the start out note is somwhere around a C#, but I don't think we are talking the standard A 440 mhz... tuning.. Though that's not the most important part. The intervals will define the tune. It sounds like some of the notes are in between. So if your 3310 can only make "clear" notes with a half step movement, I don't think it's possible make it sound good.
    Then you might just start out with a random note and try out notes below from that point.
    Good luck!

  • Help for i-tunes

    Hi all:
    I'm new to the world of i-tunes.  I just bought a $14 i-tune album, and it won't work
    on my MP3 player because, as it turns out, the songs are in MPEG4 format?
    Can I solve this somehow?  Or can I get a refund from i-tunes to get my money back?
    Thanks for your help!

    Click here for information.
    (61900)

  • HELP! TV Tuner (tv@nywhere)

    hello everyone:
    I have an MSI TV @ nywhere Plus Video Capture, TV Tuner and FM Radio with Remote Control.
    The only thing that interests me is to see and hear the TV ...
    http://www.pcel.com/mp/54790.html
    I use tvtime and can see the TV channels, the problem is i can not hear any sound
    In windows 7 x64 i use CyberLink PowerCinema and all works perfect.
    This is my card
    #lscpi
    sale: Multimedia controller: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)
    i got Archlinux x64, Gnome3, PulseAudio
    Can you set tvtime with pulseaudio? someone already has made??
    I think it has to do with alsa, because the volume I get 0 and I can not go
    Let's see ... I found this http://www.linuxtv.org/wiki/index.php/M … ywhere_A/D apparently is the data from the card I have ...
    [user@archlinux ~]$ lspci -vnn
    01:00.0 Multimedia controller [0480]: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decoder [1131:7133] (rev d1)
    Subsystem: Micro-Star International Co., Ltd. TV@nywhere Plus [1462:6231]
    Flags: bus master, medium devsel, latency 32, IRQ 21
    Memory at fe410000 (32-bit, non-prefetchable) [size=2K]
    Capabilities: <access denied>
    Kernel driver in use: saa7134
    Kernel modules: saa7134
    --->When I start tvtime salts me this:
    [user@archlinux ~]$ tvtime
    Ejecutando tvtime 1.0.2.
    Leyendo la configuración de /etc/tvtime/tvtime.xml
    Leyendo la configuración de /home/user/.tvtime/tvtime.xml
    mixer: Can't open device /dev/mixer, mixer volume and mute unavailable.
    Screenshots
    https://plus.google.com/photos/10228077 … y_bX2cf0Jw
    thanks for help
    Last edited by elcarlosgr83 (2012-01-14 15:49:44)

    Quite a few hits on google for "mixer: Can't open device /dev/mixer, mixer volume and mute unavailable."
    Have a look at:
    https://bugs.launchpad.net/ubuntu/+sour … bug/613809
    https://bugs.launchpad.net/ubuntu/+sour … bug/650693
    They relate to ubuntu packages but maybe helpful.

  • Please help!  i tunes won't display song list or artist ??

    have 2 identical new computers and have installed itunes on both. One computer will open the cd automatically but does not display the artist and songs. The other computer automatically opens the cd and displays both the titles and artist. I must have a setting wrong on my one computer somewhere but have no idea where to look. I have un installed and re installed i tunes a few times but the settings never change. I have put both as my default player but still no luck. Please help!

    Thanx for responding vdub, I deleted I tunes because I made the mistake of importing all of my music for a second time after adding all of my music to my new external hard drive and what happened, was, that created duplicates of almost all of my files and triples and quads of a whole lot of them. After spending 2 days trying to manually delete the duplicates and barely putting a dent in it, I decide it would be easier to just delete everything and just start over, well apparently that was a bad idea because now I've been trying to reinstall itunes for about a week with no success. Also retrieving it from the recycle bin is not an option because, of course, I emptied the bin. I'm lost,....

  • Help for Rewrite/tune the quey

    Hi,
    Could you please help to rewrite or tune the below query.
    database
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bitQuery
    SELECT *
    FROM
      (SELECT q.*,
        ROWNUM          AS rowindex,
        COUNT(*) OVER() AS record_count
      FROM
        (SELECT get_cand_session_number(ccr.split_session_year,ccr.split_session_month,ccr.candidate) AS candidate_session_number,
          ca.candidate,
          ca.lastname,
          ca.firstname,
          (SELECT csl.status_type
          FROM ibis.cw_status_lookup csl
          WHERE csl.status_id = ccp.status_id
          ) AS status,
          ccp.candidate_portfolio_id
        FROM ibis.candidate_component_reg ccr
        INNER JOIN
          (SELECT self_taught,
            YEAR,
            MONTH,
            main_school,
            candidate,
            subject,
            subject_option,
            lvl,
            language,
            withdrawn,
            programme
          FROM ibis.candidate_subject_registration
          ) csr
        ON csr.year           = :v_year
        AND csr.month         =:v_month
        AND csr.main_school   =ccr.main_school
        AND csr.candidate     =ccr.candidate
        AND csr.subject       =ccr.subject
        AND csr.subject_option=ccr.subject_option
        AND csr.lvl           = ccr.lvl
        AND csr.language      =ccr.language
        AND csr.withdrawn     ='N'
        INNER JOIN
          (SELECT YEAR,
            MONTH,
            candidate,
            programme,
            exam_seq_num
          FROM ibis.candidate_session_detail
          ) csd
        ON csd.year          = :v_year
        AND csd.month        = :v_month
        AND csd.candidate    = csr.candidate
        AND csd.programme    = ccr.programme
        AND csd.exam_seq_num = NVL(NULL,csd.exam_seq_num)
        INNER JOIN
          (SELECT candidate,lastname,firstname FROM ibis.candidate
          ) ca
        ON ca.candidate=csd.candidate
        INNER JOIN
          (SELECT status_id,
            candidate_portfolio_id,
            YEAR,
            MONTH,
            paper_code,
            candidate
          FROM ibis.cw_candidate_portfolio
          ) ccp
        ON ccp.year                  = :v_year
        AND ccp.month                = :v_month
        AND ccp.paper_code           = ccr.paper_code
        AND ccp.candidate            = ccr.candidate
        WHERE ccr.split_session_year = :v_year
        AND ccr.split_session_month  = :v_month
        AND ccr.component            = :v_component
        AND ccr.withdrawn            ='N'
        AND ccr.assessment_school    =NVL(:v_school_code,ccr.assessment_school)
        AND ccr.subject              = NVL(:v_subject,ccr.subject)
        AND ccr.subject_option       = NVL(:v_subject_option,ccr.subject_option)
        AND ccr.lvl                  = NVL(:v_lvl,ccr.lvl)
        AND ccr.language             = NVL(:v_language,ccr.language)
        AND ((csr.self_taught        ='N'
        AND ccr.sampled              ='Y'
        AND ccr.deleted_from_sample  ='N'
        AND EXISTS
          (SELECT 1
          FROM ibis.subject_component sc
          WHERE sc.year               = ccr.split_session_year
          AND sc.month                = ccr.split_session_month
          AND ccr.paper_code          =sc.paper_code
          AND sc.subject              = ccr.subject
          AND sc.subject_option       =ccr.subject_option
          AND sc.lvl                  = ccr.lvl
          AND sc.language             =ccr.language
          AND sc.component            =ccr.component
          AND sc.assessment_method_id = 11
          AND sc.assessment_type      = 'INTERNAL'
        AND NOT EXISTS
          (SELECT 1
          FROM ibis.cw_portfolio_template cpt
          WHERE ccr.split_session_year = cpt.year
          AND ccr.split_session_month  = cpt.month
          AND ccr.subject              = cpt.subject
          AND ccr.subject_option       = cpt.subject_option
          AND ccr.component            = cpt.component
          AND cpt.combined             = 'Y'
        OR (csr.self_taught='Y'
        AND EXISTS
          (SELECT 1
          FROM ibis.subject_component sc
          WHERE sc.year               = ccr.split_session_year
          AND sc.month                = ccr.split_session_month
          AND ccr.paper_code          =sc.paper_code
          AND sc.subject              = ccr.subject
          AND sc.subject_option       =ccr.subject_option
          AND sc.lvl                  = ccr.lvl
          AND sc.language             =ccr.language
          AND sc.component            =ccr.component
          AND sc.assessment_method_id = 11
          AND sc.assessment_type      = 'INTERNAL'
        AND NOT EXISTS
          (SELECT 1
          FROM ibis.cw_portfolio_template cpt
          WHERE ccr.split_session_year = cpt.year
          AND ccr.split_session_month  = cpt.month
          AND ccr.subject              = cpt.subject
          AND ccr.subject_option       = cpt.subject_option
          AND ccr.component            = cpt.component
          AND cpt.combined             = 'Y'
        OR (EXISTS
          (SELECT 1
          FROM ibis.cw_portfolio_template cpt
          WHERE ccr.split_session_year = cpt.year
          AND ccr.split_session_month  = cpt.month
          AND ccr.subject              = cpt.subject
          AND ccr.subject_option       = cpt.subject_option
          AND ccr.component            = cpt.component
          AND cpt.combined             = 'Y'
        AND EXISTS
          (SELECT 1
          FROM ibis.subject_component sc
          WHERE sc.year               = ccr.split_session_year
          AND sc.month                = ccr.split_session_month
          AND ccr.paper_code          =sc.paper_code
          AND sc.subject              = ccr.subject
          AND sc.subject_option       =ccr.subject_option
          AND sc.lvl                  = ccr.lvl
          AND sc.language             =ccr.language
          AND sc.component            =ccr.component
          AND sc.assessment_method_id = 11
        UNION
        SELECT get_cand_session_number(ssm.year,ssm.month,ccr.candidate) AS candidate_session_number,
          ca.candidate,
          ca.lastname,
          ca.firstname,
          (SELECT csl.status_type
          FROM ibis.cw_status_lookup csl
          WHERE csl.status_id = ccp.status_id
          ) AS status,
          ccp.candidate_portfolio_id
        FROM ibis.school_sample_mark_additional ssm,
          ibis.candidate_component_reg ccr,
          ibis.candidate ca,
          ibis.candidate_session_detail csd,
          ibis.cw_candidate_portfolio ccp
        WHERE ssm.year              = :v_year
        AND ssm.month               = :v_month
        AND ssm.candidate          IS NOT NULL
        AND ssm.year                = ccr.split_session_year
        AND ssm.month               =ccr.split_session_month
        AND ccr.assessment_school   =ssm.school_code
        AND ssm.candidate           =ccr.candidate
        AND ssm.paper_code          = ccr.paper_code
        AND ccr.component           = :v_component
        AND ccr.split_session_year  = csd.year
        AND ccr.split_session_month = csd.month
        AND ccr.candidate           =csd.candidate
        AND ccr.programme           = csd.programme
        AND csd.candidate           =ca.candidate
        AND ccr.split_session_year  = ccp.year
        AND ccr.split_session_month = ccp.month
        AND ccr.paper_code          =ccp.paper_code
        AND ccr.candidate           = ccp.candidate
        AND ssm.school_code         = NVL(:v_school_code,ssm.school_code)
        AND ccr.subject             = NVL(:v_subject,ccr.subject)
        AND ccr.subject_option      = NVL(:v_subject_option,ccr.subject_option)
        AND ccr.lvl                 = NVL(:v_lvl,ccr.lvl)
        AND ccr.language            = NVL(:v_language,ccr.language)
        AND csd.exam_seq_num        = NVL(:v_candidate,csd.exam_seq_num)
        )q
      ) sq
    WHERE ROWINDEX >=:v_startrow
    AND ROWINDEX   <= (:v_startrow + (:v_maxrows - 1) );explain plan
    | Id  | Operation                                  | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |                                                                                                                                                                               
    |   0 | SELECT STATEMENT                           |                                |     4 |  8708 |   363   (1)| 00:00:06 |                                                                                                                                                                               
    |*  1 |  FILTER                                    |                                |       |       |            |          |                                                                                                                                                                               
    |*  2 |   VIEW                                     |                                |     4 |  8708 |   363   (1)| 00:00:06 |                                                                                                                                                                               
    |   3 |    WINDOW BUFFER                           |                                |     4 |  8604 |   363   (1)| 00:00:06 |                                                                                                                                                                               
    |   4 |     COUNT                                  |                                |       |       |            |          |                                                                                                                                                                               
    |   5 |      VIEW                                  |                                |     4 |  8604 |   363   (1)| 00:00:06 |                                                                                                                                                                               
    |   6 |       SORT UNIQUE                          |                                |     4 |  1016 |   363  (14)| 00:00:06 |                                                                                                                                                                               
    |   7 |        UNION-ALL                           |                                |       |       |            |          |                                                                                                                                                                               
    |   8 |         CONCATENATION                      |                                |       |       |            |          |                                                                                                                                                                               
    |*  9 |          FILTER                            |                                |       |       |            |          |                                                                                                                                                                               
    |* 10 |           FILTER                           |                                |       |       |            |          |                                                                                                                                                                               
    |  11 |            TABLE ACCESS BY INDEX ROWID     | CW_CANDIDATE_PORTFOLIO         |     1 |    44 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |  12 |             NESTED LOOPS                   |                                |     1 |   270 |   299   (1)| 00:00:05 |                                                                                                                                                                               
    |  13 |              NESTED LOOPS                  |                                |     1 |   226 |   296   (1)| 00:00:05 |                                                                                                                                                                               
    |  14 |               NESTED LOOPS                 |                                |     1 |   200 |   294   (1)| 00:00:05 |                                                                                                                                                                               
    |  15 |                NESTED LOOPS                |                                |    35 |  3080 |   190   (1)| 00:00:03 |                                                                                                                                                                               
    |  16 |                 TABLE ACCESS BY INDEX ROWID| CANDIDATE_SESSION_DETAIL       |    35 |   980 |    92   (2)| 00:00:02 |                                                                                                                                                                               
    |* 17 |                  INDEX RANGE SCAN          | SESSION_SCHL_CAND              |    35 |       |    77   (2)| 00:00:02 |                                                                                                                                                                               
    |* 18 |                 TABLE ACCESS BY INDEX ROWID| CANDIDATE_SUBJECT_REGISTRATION |     1 |    60 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 19 |                  INDEX RANGE SCAN          | Y_M_CAND_SUBJ_LVL_OPTION       |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 20 |                TABLE ACCESS BY INDEX ROWID | CANDIDATE_COMPONENT_REG        |     1 |   112 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 21 |                 INDEX RANGE SCAN           | SPLIT_SESSION_CANDIDATE        |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |  22 |               TABLE ACCESS BY INDEX ROWID  | CANDIDATE                      |     1 |    26 |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 23 |                INDEX UNIQUE SCAN           | CANDIDATE_PK                   |     1 |       |     1   (0)| 00:00:01 |                                                                                                                                                                               
    |* 24 |              INDEX RANGE SCAN              | CANDIDATE_PORTFOLIO_INDEX1     |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 25 |           TABLE ACCESS BY INDEX ROWID      | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 26 |            INDEX RANGE SCAN                | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 27 |            TABLE ACCESS BY INDEX ROWID     | SUBJECT_COMPONENT              |     1 |    96 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 28 |             INDEX RANGE SCAN               | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 29 |             TABLE ACCESS BY INDEX ROWID    | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 30 |              INDEX RANGE SCAN              | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 31 |              TABLE ACCESS BY INDEX ROWID   | SUBJECT_COMPONENT              |     1 |    96 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 32 |               INDEX RANGE SCAN             | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 33 |               TABLE ACCESS BY INDEX ROWID  | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 34 |                INDEX RANGE SCAN            | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 35 |                TABLE ACCESS BY INDEX ROWID | SUBJECT_COMPONENT              |     1 |    87 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 36 |                 INDEX RANGE SCAN           | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 37 |          FILTER                            |                                |       |       |            |          |                                                                                                                                                                               
    |* 38 |           FILTER                           |                                |       |       |            |          |                                                                                                                                                                               
    |  39 |            NESTED LOOPS                    |                                |     1 |   270 |    16   (0)| 00:00:01 |                                                                                                                                                                               
    |  40 |             NESTED LOOPS                   |                                |     1 |   244 |    14   (0)| 00:00:01 |                                                                                                                                                                               
    |  41 |              NESTED LOOPS                  |                                |     1 |   216 |    12   (0)| 00:00:01 |                                                                                                                                                                               
    |  42 |               NESTED LOOPS                 |                                |     1 |   156 |     9   (0)| 00:00:01 |                                                                                                                                                                               
    |* 43 |                TABLE ACCESS BY INDEX ROWID | CANDIDATE_COMPONENT_REG        |     1 |   112 |     6   (0)| 00:00:01 |                                                                                                                                                                               
    |* 44 |                 INDEX RANGE SCAN           | ASSESSMENT_SPLIT_SESSION       |     1 |       |     5   (0)| 00:00:01 |                                                                                                                                                                               
    |  45 |                TABLE ACCESS BY INDEX ROWID | CW_CANDIDATE_PORTFOLIO         |     1 |    44 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 46 |                 INDEX RANGE SCAN           | CANDIDATE_PORTFOLIO_INDEX1     |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 47 |               TABLE ACCESS BY INDEX ROWID  | CANDIDATE_SUBJECT_REGISTRATION |     1 |    60 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 48 |                INDEX RANGE SCAN            | CAND_REG_SCHOOL                |     1 |       |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 49 |              TABLE ACCESS BY INDEX ROWID   | CANDIDATE_SESSION_DETAIL       |     1 |    28 |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 50 |               INDEX UNIQUE SCAN            | CANDIDATE_DETAIL_PK            |     1 |       |     1   (0)| 00:00:01 |                                                                                                                                                                               
    |  51 |             TABLE ACCESS BY INDEX ROWID    | CANDIDATE                      |     1 |    26 |     2   (0)| 00:00:01 |                                                                                                                                                                               
    |* 52 |              INDEX UNIQUE SCAN             | CANDIDATE_PK                   |     1 |       |     1   (0)| 00:00:01 |                                                                                                                                                                               
    |* 53 |           TABLE ACCESS BY INDEX ROWID      | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 54 |            INDEX RANGE SCAN                | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 55 |            TABLE ACCESS BY INDEX ROWID     | SUBJECT_COMPONENT              |     1 |    96 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 56 |             INDEX RANGE SCAN               | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 57 |             TABLE ACCESS BY INDEX ROWID    | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 58 |              INDEX RANGE SCAN              | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 59 |              TABLE ACCESS BY INDEX ROWID   | SUBJECT_COMPONENT              |     1 |    96 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 60 |               INDEX RANGE SCAN             | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 61 |               TABLE ACCESS BY INDEX ROWID  | CW_PORTFOLIO_TEMPLATE          |     1 |    46 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 62 |                INDEX RANGE SCAN            | YEAR_MON_PORTFOLIO_TEMPLATE    |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |* 63 |                TABLE ACCESS BY INDEX ROWID | SUBJECT_COMPONENT              |     1 |    87 |     4   (0)| 00:00:01 |                                                                                                                                                                               
    |* 64 |                 INDEX RANGE SCAN           | SUBJECT_COMPONENT_PK           |     1 |       |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |  65 |         CONCATENATION                      |                                |       |       |            |          |                                                                                                                                                                               
    |* 66 |          FILTER                            |                                |       |       |            |          |                                                                                                                                                                               
    |  67 |           TABLE ACCESS BY INDEX ROWID      | CW_CANDIDATE_PORTFOLIO         |     1 |    44 |     3   (0)| 00:00:01 |                                                                                                                                                                               
    |  68 |            NESTED LOOPS                    |                                |     1 |   238 |    23   (0)| 00:00:01 |                                                                                                                                                                               
    |  69 |             NESTED LOOPS                   |                                |     1 |   194 |    20   (0)| 00:00:01 |                                                                                                                                                                               
    |  70 |              NESTED LOOPS                  |                                |     1 |   168 |    18   (0)| 00:00:01 |Edited by: user575115 on

    Hi
    i have seen your query and i am nt changing the whole query but i'll recommend some of the changes it may helps in the performance tuning...
    1) write all the filter conditions in the FROM clause in correspondence to the tables for ex :
    One way : select * from tab a, tab1 b where a.c = b.c and a.d in ('xx','lll')
    Tuned way : select * from (select c from tab where d in ('xx','lll')) a, tab b where a.c = b.c (it provides lesser rows for joining)
    2) Donot write Inline query in the select statement.You can try it.
    for ex:
    One way : select a.c, (select d from tab1 where tab1.d = a.e) from tab a
    tuned way : select a.c, tab1.d from tab a, tab1 where tab1.d = a.e
    3) Check the gathering of stats in 10G
    4) Avoid using ANSI standered for JOINS for ex : Instead of select * from a inner join a on ... use select * from a, b where joining cond.(I am not confirmed)
    5) If possible here use the WITH clause becuase you have use UNION and you have use some common tables which are executing twice in the current.
    6) Use some HINTS like FIRST_ROWS
    If somewhere i am wrong please correct me.
    Edited by: user9292111 on 22-Mar-2012 01:52
    Edited by: user9292111 on 22-Mar-2012 01:53

  • Need help getting I-tunes to run on XP

    I have tried most all the tricks listed and still I-tunes will not run on relatively new windows XP, Dell machine (also newly purchased I-pod), - I have disabled virus protection, I have loaded most recent versions of i-tunes, I have cleared temp files and reloaded. I tried loading Q-time player as a stand alone. I deleted old folders of I-tunes and Q-time and reloaded.
    I-tunes down-loads without any error message. the I-pod connects to USB and charges - and shows up as an "E" drive. But clicking on i-tunes icon, or loading audio disk or connecting I-pod all fail to visably launch i-tunes (nothing is seen in task manager after attempting to launch I-tunes - but on shut down of the computer I get the message that I-tunes is not responding and must be shut down manually) (also for grins I tried launching newly loaded Q-time -> I get message saying its loading, but this message never clears). Already 10 hours spent on this

    Hello,
    Unfortunantly, I'm not quite good in JavaScript to give you a good response. But I can you give you an advise, that can help you:
    1. Add a simle system.out.println("Init called!"); message in public void init() method of the servlet RefreshInfo.
    2. Try to access servlet by simple browser request "http://localhost:8080/yourApp/RefreshInfo".
    2. If the message "Init called!" appears in the Tomcat console, your servlet code is correct and the serlet is described properly in web.xml . In this case, the possible problem is in the JavaScript code.
    Good day,
    http://www.myjavaserver.com/~voronetskyy/

Maybe you are looking for

  • New session rejected due to memory bottleneck

    Dear All,             I have creating and working on BSP aplication that calls the webGui, ie abap trnasaction on internet explorer.It worked onced but then i get the error. New session rejected due to memory bottleneck  : The URL http://XXXXXX.YYYYY

  • Update of Z field in marc in ALE/IDOC

    Hi, I have an inbound IDOC in which I get the data for all the Z field which is appended in MARC table. When I am calling the FM 'IDOC_INPUT_MATMAS01' it is not updaiting the Z field and the IDOC is successfully created. Do I have to write the updaet

  • Local database connection

    I am using developer 3.0 on the NT server machine, with oracle 8 I want to connect with my local database which step i need to take. please help me in detail

  • QT does not open AVI file

    hello, I have installed Perian but with Mountain Lion QT does not open AVI file (no audio and no video) do you have any suggestion?

  • DNG files rendered with wrong color profile?

    Does someone else also have a problem with DNG (digital negative) files showing incorrect colors when opened in Apple software (Preview, iPhoto, Aperture..)? I have a Nikon D750 and currently consider using DNG as archive format for my RAW files. But