XMLIndex performance regarding // (any descendant)

The following is my scenario:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
create table t1 (ID NUMBER(19) NOT NULL, XMLDATA XMLType) xmltype column "XMLDATA" STORE AS BINARY XML;
-- insert 50916 rows of XML documents into t1
create index IDX_7 on t1(XMLDATA) indextype is xdb.xmlindex PARAMETERS ( 'PATHS ( INCLUDE (//FIELD_1_2))' );
Query 1:
SQL> SELECT /*+ NO_XMLINDEX_REWRITE */ COUNT(ID) FROM T1 Z WHERE Z.XMLDATA.EXISTSNODE('//FIELD_1_2') = 1;
3622
Elapsed: 00:00:01.71
Access Plan:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2002 | 246 (3)| 00:00:03 |
| 1 | SORT AGGREGATE | | 1 | 2002 | | |
|* 2 | TABLE ACCESS FULL| T1 | 59765 | 114M| 246 (3)| 00:00:03 |
Predicate Information (identified by operation id):
2 - filter(EXISTSNODE(SYS_MAKEXML(0,"Z"."SYS_NC00004$"),'//FIELD_1_2')=1)
Query 2:
SQL> SELECT COUNT(ID) FROM T1 Z WHERE Z.XMLDATA.EXISTSNODE('//FIELD_1_2') = 1;
3622
Elapsed: 00:01:20.59
Access Plan:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 12 | 109K (1)| 00:21:57 |
| 1 | SORT AGGREGATE | | 1 | 12 | | |
|* 2 | FILTER | | | | | |
| 3 | TABLE ACCESS FULL | T1 | 59765 | 700K| 239 (1)| 00:00:03 |
| 4 | NESTED LOOPS | | | | | |
| 5 | NESTED LOOPS | | 1 | 2028 | 2 (0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID| X$PT1MP1MWL3978FCE0G24J0CM85AM | 1 | 1008 | 0 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | X$PR1MP1MWL3978FCE0G24J0CM85AM | 1 | | 0 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS70559_IDX_7_PATHID_IX | 1 | | 1 (0)| 00:00:01 |
|* 9 | TABLE ACCESS BY INDEX ROWID | SYS70559_IDX_7_PATH_TABLE | 1 | 1020 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter( EXISTS (SELECT 0 FROM "SCHEMA"."SYS70559_IDX_7_PATH_TABLE"
"SYS_P0","XDB"."X$PT1MP1MWL3978FCE0G24J0CM85AM" "SYS_PT_SUFFIX_2" WHERE
SYS_PATH_REVERSE("PATH")<HEXTORAW('0269C9FF') AND SYS_PATH_REVERSE("PATH")>=HEXTORAW('0269C9') AND
"SYS_P0"."RID"=:B1 AND "SYS_P0"."PATHID"="ID" AND SYS_XMLI_LOC_ISNODE("SYS_P0"."LOCATOR")=1))
7 - access(SYS_PATH_REVERSE("PATH")>=HEXTORAW('0269C9') AND
SYS_PATH_REVERSE("PATH")<HEXTORAW('0269C9FF') )
8 - access("SYS_P0"."PATHID"="ID" AND "SYS_P0"."RID"=:B1)
9 - filter(SYS_XMLI_LOC_ISNODE("SYS_P0"."LOCATOR")=1)
Query 1 suppresses the use of the XMLIndex IDX_7, while Query 2 makes use of IDX_7. It seems better to run with the use of XMLIndex in this case.
Why is the cost of Query 2 so much greater than Query 1 when the XMLIndex is actually used?
Thanks.
P.

Yes, I created statistics using DBMS_STATS.GATHER_INDEX_STATS.
If you look at the costs on line 1, it's Query 1 (246) vs Query 2 (107K). It's a huge difference.
I have to use //FIELD_1_2 in the query since I don't know where FIELD_1_2 is exactly in these documents. There are multiple XML schemas (not registered though) for this XMLType column.
Let's remove /*+ NO_XMLINDEX_REWRITE */ from Query 1, then Query 1 and Query 2 are the same. The optimizer chooses a different plan depending on if IDX_7 exists or not. If IDX_7 is not created, the performance for Query 1 is observed, otherwise, the performance for Query 2 is observed.
I also tried another path subsetting in the XMLIndex:
create index IDX_8 on t1(XMLDATA) indextype is xdb.xmlindex PARAMETERS ( 'PATHS ( INCLUDE (/*/FIELDS/FIELD_1/FIELD_1_2))' );
Query 3:
SELECT COUNT(ID) FROM T1 Z WHERE Z.XMLDATA.EXISTSNODE('/*/FIELDS/FIELD_1/FIELD_1_2') = 1;
Query 3 shows slower performance in the same manner compared to running the same query without IDX_8 created.
Query 4:
SELECT COUNT(ID) FROM T1 Z WHERE Z.XMLDATA.EXISTSNODE('/SPEC_47/FIELDS/FIELD_1/FIELD_1_2') = 1;
Query 4 runs much faster with the IDX_8 created than without it.
Let me ask the question differently. What can I do to improve the performance of the following query?
SELECT COUNT(ID) FROM T1 Z WHERE Z.XMLDATA.EXISTSNODE('//FIELD_1_2') = 1;
My attempts so far to create an XMLIndex with different path subsetting on the XMLDATA column actually caused the query to run slower instead of faster.
Thanks.
P.

Similar Messages

  • Since loading Lion, I've experienced much more instability than Snow Leopard. In particular, Mail crashes with regularity, full-screen apps seem to run slower and show the beach ball more often for longer, etc.  I'm disappointed with the performance. Any

    Since loading Lion, I've experienced much more instability than Snow Leopard. In particular, Mail crashes with regularity, full-screen apps seem to run slower and show the beach ball more often for longer, etc. I love the features, but I'm disappointed with the performance. Any help coming from Apple?  I've been sending them so many reports after crashes, that their file must be full!

    Summoning max. courage, I did what you advised. Here is the result. What does this tell you? My Lion 7.2 (mid 2011 iMac) has several annoying glitches (which I have so far tolerated through gritted teeth) but none that have actually stopped me working.
    BTW, I see several items involving CleanMyMac which I did not know I had. It is generally villified as a trouble-maker. Spotlight can't find an app. or a utility of that name. How can I get rid of what's there please? Just delete?
    Last login: Thu Nov  3 20:55:11 on console
    Steve-Kirkbys-iMac:~ stevekirkby$ kextstat -kl | awk ' !/apple/ { print $6 $7 } '
    com.AmbrosiaSW.AudioSupport(4.0)
    Steve-Kirkbys-iMac:~ stevekirkby$ sudo launchctl list | sed 1d | awk ' !/0x|apple|com\.vix|edu\.|org\./ { print $3 } '
    Password:
    com.openssh.sshd
    com.stclairsoft.DefaultFolderXAgent
    com.microsoft.office.licensing.helper
    com.bombich.ccc.scheduledtask.067493DB-2728-4DF3-87D8-092EF69086E8
    com.bombich.ccc
    com.adobe.SwitchBoard
    Steve-Kirkbys-iMac:~ stevekirkby$ launchctl list | sed 1d | awk ' !/0x|apple|edu\.|org\./ { print $3 } '
    com.sony.PMBPortable.AutoRun
    uk.co.markallan.clamxav.freshclam
    com.veoh.webplayer.startup
    com.macpaw.CleanMyMac.volumeWatcher
    com.macpaw.CleanMyMac.trashSizeWatcher
    com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae
    com.adobe.AAM.Scheduler-1.0
    Steve-Kirkbys-iMac:~ stevekirkby$ ls -1A {,/}Library/{Ad,Compon,Ex,Fram,In,La,Mail/Bu,P*P,Priv,Qu,Scripti,Sta}* 2> /dev/null
    /Library/Components:
    /Library/Extensions:
    /Library/Frameworks:
    AEProfiling.framework
    AERegistration.framework
    ApplicationEnhancer.framework
    AudioMixEngine.framework
    FxPlug.framework
    NyxAudioAnalysis.framework
    PluginManager.framework
    ProFX.framework
    ProMetadataSupport.framework
    TSLicense.framework
    iLifeFaceRecognition.framework
    iLifeKit.framework
    iLifePageLayout.framework
    iLifeSQLAccess.framework
    iLifeSlideshow.framework
    /Library/Input Methods:
    /Library/Internet Plug-Ins:
    AdobePDFViewer.plugin
    EPPEX Plugin.plugin
    Flash Player.plugin
    Flip4Mac WMV Plugin.plugin
    JavaAppletPlugin.plugin
    Quartz Composer.webplugin
    QuickTime Plugin.plugin
    SharePointBrowserPlugin.plugin
    SharePointWebKitPlugin.webplugin
    Silverlight.plugin
    flashplayer.xpt
    iPhotoPhotocast.plugin
    nsIQTScriptablePlugin.xpt
    /Library/LaunchAgents:
    com.adobe.AAM.Updater-1.0.plist
    com.sony.PMBPortable.AutoRun.plist
    /Library/LaunchDaemons:
    com.adobe.SwitchBoard.plist
    com.apple.remotepairtool.plist
    com.bombich.ccc.plist
    com.bombich.ccc.scheduledtask.067493DB-2728-4DF3-87D8-092EF69086E8.plist
    com.microsoft.office.licensing.helper.plist
    com.stclairsoft.DefaultFolderXAgent.plist
    /Library/PreferencePanes:
    .DS_Store
    Application Enhancer.prefPane
    Default Folder X.prefPane
    DejaVu.prefPane
    Flash Player.prefPane
    Flip4Mac WMV.prefPane
    /Library/PrivilegedHelperTools:
    com.bombich.ccc
    com.microsoft.office.licensing.helper
    com.stclairsoft.DefaultFolderXAgent
    /Library/QuickLook:
    iWork.qlgenerator
    /Library/QuickTime:
    AppleIntermediateCodec.component
    AppleMPEG2Codec.component
    DesktopVideoOut.component
    DivX 6 Decoder.component
    FCP Uncompressed 422.component
    Flip4Mac WMV Advanced.component
    Flip4Mac WMV Export.component
    Flip4Mac WMV Import.component
    LiveType.component
    /Library/ScriptingAdditions:
    .DS_Store
    Adobe Unit Types.osax
    Default Folder X Addition.osax
    /Library/StartupItems:
    Library/Address Book Plug-Ins:
    Library/Frameworks:
    EWSMac.framework
    Library/Input Methods:
    .localized
    Library/Internet Plug-Ins:
    Library/LaunchAgents:
    com.adobe.AAM.Updater-1.0.plist
    com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
    com.macpaw.CleanMyMac.trashSizeWatcher.plist
    com.macpaw.CleanMyMac.volumeWatcher.plist
    com.veoh.webplayer.startup.plist
    uk.co.markallan.clamxav.freshclam.plist
    Library/PreferencePanes:
    .DS_Store
    Perian.prefPane
    WindowShade X.prefPane
    Library/QuickTime:
    AC3MovieImport.component
    Perian.component
    Library/ScriptingAdditions:
    Steve-Kirkbys-iMac:~ stevekirkby$

  • I am using Vista (64) and Photo Elemnts 7 to access.  When I try to load the "Editor" regarding any

    I am using Vista (64) and Photo Elemnts 7 to access.  When I try to load the “Editor” regarding any photos from “Organizer” I get the message “Runtime Error!
    Program:,,,,Adobe\Photoshop Elements 7.0\PhotoshopElementsEditor.exe
    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.”

    You have the latest release version of Firefox, ignore those prompts from Yahoo about updating. They're trying to entice you to install their special "Yahoo enhanced" build of Firefox, that has extras which many people consider as being Malware.

  • BULK COLLECT LIMIT affects performance in any way?

    Hi,
    I want to know whether BULK COLLECT LIMIT affects performance in any way?
    How does one decide what limit to keep?
    is there a oracle recommendation on the same?

    I agree with Bonist that you should read Tom's article but I am going to disagree, to a minor extent, with Tom's comment about 100 rows.
    When developing with BULK COLLECT I always add a parameter to stored procedures that is used to tune the limit clause Then when the code goes to unit testing, and at the beginning of integrated unit testing, the value is varied and the results graphed. For final testing the parameter is dropped. The number I hard code for production is the value at the left side of the top of the bell curve.
    What I find is that 100 is sometimes the right number butI have one app I developed recently where 50,000 was the right number (11gR1). As with almost everything Oracle the best answer is always that "it depends." In the case where 50K is the best solution the server has 32G of RAM, and everything processed is an SMS message averaging only 79 bytes.

  • Performance Tuning (creating Descending Indexes)

    Hi,
    There is a huge table about 70 million Records. Huge data pool happens daily for the sysdate.
    For this table there is composite Primary key of c1,c2,c3 and hence the index is created (asc default).
    On Online Screen the latest data is queried from this table. Hence the Query is having order by c1 desc, order by c2 desc, order by c3 will there be any performance improvement if the indexes are created for the PK Columns in descending order?
    Thanking in anticipation.
    Edited by: user505907 on Jan 5, 2010 3:25 AM

    The Query returns roughly 2000 Records and display 50 Rows at a time on the screen.
    The Optimizer Mode is ALL_ROWS. I'm running the query in Oracle 10g
    Here is the Query and the Explain plan for the same. Pls Note that to maintain information integrity I masked the exact table and column names with the dummy names.
    SELECT DISTINCT
    TABLE01.UNIQU,
    TABLE01.SNO,
    TO_CHAR(TABLE02.CREATE_DATE,'YYYY-MM-DD'),
    TABLE02.TYPE,
    TABLE02.RDN,
    TABLE02.C_RDN,
    TABLE02.UNC_RDN,
    TABLE02.UNIQU,
    TABLE03.MODEL_ID,
    TABLE03.INDI.
    TABLE02.RD_DATE
    FROM
    TABLE01,
    TABLE02,
    TABLE03,
    TABLE04
    WHERE
    TABLE04.ID = 1234 AND TABLE04.UNIQU =TABLE01.UNIQU AND
    TABLE02.UNIQU = TABLE01.UNIQU AND
    TABLE02.RD_DATE <=TO_DATE('20101231','YYYY-MM-DD') AND
         TABLE01.MODEL_ID = TABLE03L.MODEL_ID
    ORDER BY TABLE02.RD_DATE DESC,
    TABLE01.UNIQU DESC,
    TABLE02.TYPE DESC
    SQL> SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY(NULL,NULL,'TYPICAL'));
    PLAN_TABLE_OUTPUT
    Plan hash value: 2353636552
    | Id | Operation | Name | Rows| Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 6 | 516 | 1462 (1) | 00:00:21 |
    | 1 | SORT UNIQUE | | 6 | 516 | 1461 (1) | 00:00:21 |
    | 2 | TABLE ACCESS BY INDEX ROWID | TABLE02 | 2 | 84 | 1429 (1) | 00:00:21 |
    | 3 | NESTED LOOPS | | 6 | 516 | 1460 (1) | 00:00:21 |
    | 4 | NESTED LOOPS | | 4 | 176 | 19 (0) | 00:00:01 |
    | 5 | NESTED LOOPS | | 4 | 148 | 15 (0) | 00:00:01 |
    | 6 | TABLE ACCESS BY INDEX ROWID | TABLE04 | 4 | 56 | 7 (0) | 00:00:01 |
    |* 7 | INDEX RANGE SCAN |TAB04_IND | 4 | | 3 (0) | 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID | TABLE01 | 1 | 23 | 2 (0) | 00:00:01 |
    |* 9 | INDEX UNIQUE SCAN |TAB01_IND | 1 | | 1 (0) | 00:00:01 |
    | 10 | TABLE ACCESS BY INDEX ROWID | TABLE03 | 1 | 7 | 1 (0) | 00:00:01 |
    |* 11 | INDEX UNIQUE SCAN |TAB03_IND | 1 | | 0 (0) | 00:00:01 |
    |* 12 | INDEX RANGE SCAN |TAB02_IND | 1468 | | 4 (0) | 00:00:01 |
    Predicate Information (identified by operation id):
    7 - access("TABLE04"."ID"=1234)
    9 - access(""TABLE04"."UNIQU"="TABLE01"."UNIQU")
    11 - access("TABLE01"."MODEL_ID"="TABLE03"."MODEL_ID")
    12 - access("TABLE02"."UNIQU"="TABLE01"."UNIQU" AND
    "TABLE02"."RD_DATE"<=TO_DATE('20101231','YYYY-MM-DD'))
    Edited by: user505907 on Jan 6, 2010 9:02 AM
    Edited by: user505907 on Jan 6, 2010 9:06 AM

  • Performance regarding view

    hi,
    i have a view named CREATE OR REPLACE VIEW TAX_AMT_VIEW
    (PTIN_NO, AMOUNT)
    AS
    select I_ASMTNO PTIN_NO,
    (D_CRNPT+D_CRNED+D_CRNLCS+D_CRNUAUTHCNSTPLTY+D_ARRPT+D_ARRED+D_ARRLCS
    D_ARRUAUTHCNSTPLTYD_PLTYONARR+D_ADVAMT) AMOUNT
    from DMA12.PT_ASMTRCPT_TBL;
    i am retrewing data from this view from another view CREATE OR REPLACE VIEW TAX_COLLECTION_OTHER
    (CIRCLE_NO, AMT_LKS, TOTAL)
    AS
    SELECT SUM(B.AMOUNT)/100000 AMT_LKS,count(b.ptin_no) TOTAL FROM dma12.PT_RECEIPT_TBL B,dma12.PT_ASSE_PTIN_NOINFORMATION A,
    A.PTIN_NO=B.PTIN_NO
    how can i make my view faster.
    i can i do the summation faster
    can any one suggest me
    regards,
    kishore

    alter system set __fast=true scope=spfile
    or
    read the performance tuning manual for your version
    In absence of any relevant information like
    version
    result of dbms_xplan.display
    which optimizer being used
    which columns are indexed
    do you use system stats,
    what did you try
    etc, etc, etc
    Question: if you don't want to share any information, yet are asking about a specific statement, why do you request help?
    Do you expect people here are clairvoyant?
    Sybrand Bakker
    Senior Oracle DBA

  • Does having multiple versions of Photoshop installed effect performance in any?

    I have a laptop with 8 gigs of RAM, Windows 7, i3 Intel processor, but Photoshop is very slow in responding and often I have to wait three minutes from the time I click the text entry tool until I can type, then each additional step, tool selection, whatever freezes Photoshop for several minutes. This is unacceptable, of course. Other software works normally.
    I recently bought a new laptop with an i7 Intel processor, 12 gigs of RAM, and a GeForce graphics processor and the problem is even worse! CS6 locks up so long and so often I usually just load the Task Manager and end the process!
    I have lots of fonts but doubt they could cause a problem this severe. Since the new laptop has a high definition screen, I need my font preview size to be at the largest size to see them clearly.
    Now, I have 32 and 64 bit versions of CS6, CS5, and Photoshop Elements 10 and 12 installed. I don't use them at the same time, but I'm beginning to wonder whether they might cause some performance problems. (Photoshop installed both versions when I set up this computer in January, both CS5 & CS6. I downloaded CS5 because I was afraid that if CS6 got problematic, I could switch to CS5 and use that instead but the problem is terrible.) If the 64 bit version is giving me too much trouble, I'll switch to the 32 in hopes it will work better. But especially in the new computer, Photoshop never works well.
    I bought the new laptop with the extra RAM and heavier duty processor to solve this problem in my old computer, which also has those versions of Photoshop installed. I don't use large files and do light graphic design work for my own use. The most resources intense thing I do is use smart object product mockups I buy online. I'm afraid the problem might be too many fonts but I don't want to get rid of any of them. I've too much invested in them.
    Thanks to anyone who can help.

    I did transfer all my fonts from the Windows 7 computer to the new Windows 8 laptop. I use different external HDs on the computers but I do occasionally connect any of them to the other computer to transfer large sets of files.
    No, Photoshop is on Drive C, the main internal drive on each.
    Last night I turned off font file previews in the font menu. I got much better performance. Photoshop worked much better, other than when I made a block of text and wanted to click on it and move it. It froze up for about thirty seconds before letting me do that.
    If this is a font management problem, should I get font management software? I don't know anything about such software. Do they allow you to load only the fonts you want to use, on the fly? I see one, Fusion 6, which has a CS6 plug-in, leading me to think I might be able to preview and use fonts without the drain on Photoshop's performance.
    Do you have any opinions or advice in that regard?

  • Problems with Yahoo Mail and Calendar on MacBook air.  Very slow performance.  Any ideas?

    I have a macbook air running Apple's latest OS. My system is up-to-date.  Over the last few weeks, I have had a very difficult time accessing my yahoo mail and calendar.  I can access other sites, thus I know my connection is solid.  The problem seems to be limited to Yahoo.  I can access my yahoo account on my husband's PC without any issues.  To be specific, here are the symptoms of my problem.  When I try to open my yahoo mail on the Mac, I get the spinning wheel for several minutes.  I view my yahoo calendar through ical.  Yahoo is not connecting with ical, thus my calendar is empty.  I verified my settings and they are correct.  Also, sometimes after trying and retrying the calendar will connect.  I checked the web and did not find any info about this problem.  I appreciate your assistance.

    I have been having the same issue. I can't figure it out. I have tried setting this up my yahoo calendar on my phone and my computer and my iPhone with no luck. It's definitely a Yahoo Problem. At this point I have become enemy to Yahoo Calendar.

  • Performance probelem any idea?????

    REPORT ztest .
    include ZOPEN_RTRN_data.
    include ZOPEN_RTRN_scr.
    SELECT   DISTINCT
              kdauf
              kdpos
              kunnr
              matnr
              prctr
    FROM mseg
    *UP TO lv_rows ROWS
    INTO CORRESPONDING FIELDS OF TABLE imseg
    WHERE matnr IN matnr
    AND   prctr IN prctr
    AND   kunnr IN kunnr
    AND   kdauf IN kdauf
    AND  ( bwart = '651'
    OR     bwart = '652'
    OR     bwart = '901'
    OR     bwart = '902' ).
    LOOP AT imseg ASSIGNING <f1>.
      CLEAR z651.
      CLEAR z652.
      CLEAR z901.
      CLEAR z902.
      SELECT  menge bwart
      FROM    mseg
      INTO    (mseg-menge , mseg-bwart )
    where   matnr = <f1>-matnr
    and     kunnr = <f1>-kunnr.
      WHERE  kdauf = <f1>-kdauf
      AND    kdpos = <f1>-kdpos.
        IF sy-subrc = '0'.
          CASE mseg-bwart.
            WHEN '651'.
              z651 = mseg-menge.
            WHEN '652'.
              z652 = mseg-menge.
            WHEN '901'.
              z901 = mseg-menge.
            WHEN '902'.
              z902 = mseg-menge.
            WHEN OTHERS.
              CONTINUE.
          ENDCASE.
      <f1>-recqty = z651 - z652.
      <f1>-retqty = z901 - z902.
      <f1>-diff = <f1>-recqty - <f1>-retqty.
        ENDIF.
      ENDSELECT.
    ENDLOOP.
    IF p_minus = 'X'.
      LOOP AT imseg.
        IF imseg-diff >= '0.00'.
          DELETE imseg.
        ENDIF.
      ENDLOOP.
    ENDIF.
    IF p_plus = 'X'.
      LOOP AT imseg.
        IF imseg-diff <= '0.00'.
          DELETE imseg.
        ENDIF.
      ENDLOOP.
    ENDIF.
    PERFORM alv_rep.
    *& ALV_REPORT                                          *
    FORM alv_rep.
      CLEAR i_fieldcat.
      REFRESH i_fieldcat .
      PERFORM e04_comment_build  USING gt_list_top_of_page[].
      PERFORM aufbauen_fieldcat USING 'KUNNR'     'MSEG' ' '
      PERFORM aufbauen_fieldcat USING 'KDAUF'     'MSEG' '' ''
      PERFORM aufbauen_fieldcat USING 'KDPOS'     'MSEG' '' ''
      PERFORM aufbauen_fieldcat USING 'MATNR'     'MSEG' ' '
      PERFORM aufbauen_fieldcat USING 'PRCTR' 'MSEG' ' '
    PERFORM aufbauen_fieldcat USING 'BWART' 'MSEG' ' '
    PERFORM aufbauen_fieldcat USING 'MENGE' 'MSEG' ' '
      PERFORM aufbauen_fieldcat USING 'RECQTY' ' ' 'Recieved Qnt'
      PERFORM aufbauen_fieldcat USING 'RETQTY'   ' ' 'Return Qnt'
      PERFORM aufbauen_fieldcat USING 'DIFF'   ' ' 'Diffrence'
       PERFORM aufbauen_fieldcat USING 'NAME1' 'LFA1' ' '
      PERFORM aufbauen_fieldcat USING 'DMBTR'  'EKBE' ' '
    PERFORM aufbauen_fieldcat USING 'CALC' 'T_OBJECTS' 'PO Value'
    PERFORM aufbauen_fieldcat USING 'WAERS' 'EKBE' ' '
    PERFORM aufbauen_fieldcat USING 'WAERS' 'EKBE' ' '
    **L_LAYOUT-info_fieldname = 'color_line'.
      l_layout-colwidth_optimize = 'X'.
      l_layout-info_fieldname = 'X'.
    l_layout-cell_merge = 'X'.
      l_layout-numc_sum = 'X'.
    l_layout-totals_only = 'X'.
    l_layout-totals_text = 'X'.
    l_layout-detail_initial_lines = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = sy-cprog
                i_callback_pf_status_set = 'STANDARD'
                i_callback_user_command  = 'ALV_USER_COMMAND'
                is_layout                = l_layout
               i_callback_top_of_page   = 'TOP-OF-PAGE'
                it_fieldcat              = i_fieldcat[]
                i_save                   = 'A'
                is_variant               = is_variant
                it_events                = gt_events[]
           TABLES
                t_outtab                 = imseg  "
           EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
    ENDFORM.                    "alv_rep
    *&      Form  AUFBAUEN_FIELDCAT
    FORM aufbauen_fieldcat USING  p_fieldname
                                  p_ref_tabname
                                  p_name
                                  p_sum
                                  p_emp
                                  p_out.
      i_fieldcat-fieldname = p_fieldname .
      i_fieldcat-ref_tabname = p_ref_tabname .
      i_fieldcat-reptext_ddic = p_name .
      i_fieldcat-seltext_l = p_name .
      i_fieldcat-seltext_m = p_name .
      i_fieldcat-seltext_s = p_name .
      i_fieldcat-do_sum    = p_sum .
      i_fieldcat-emphasize = p_emp .
      i_fieldcat-no_out    = p_out .
      APPEND i_fieldcat .
    ENDFORM.                    " AUFBAUEN_FIELDCAT
          FORM E04_COMMENT_BUILD                                        *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE
    slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
      CLEAR e04_lt_top_of_page .
      REFRESH e04_lt_top_of_page .
      ls_line-typ  = 'H'.
      ls_line-info = 'XXXXX'.
      APPEND ls_line TO e04_lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = text-002 .
      ls_line-info = sy-uname .
      APPEND ls_line TO e04_lt_top_of_page.
      "e04_comment_build
      CLEAR e04_lt_top_of_page .
      REFRESH e04_lt_top_of_page .
    ****end
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    ls_line-key  = ''.  "not used for this type
      ls_line-info = 'Vendor Report'(001).
      APPEND ls_line TO e04_lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ = 'S'.
      ls_line-key = text-011.
    WRITE sy-datum TO ls_line-info.
      CONCATENATE sy-datum6(2) '/' sy-datum4(2) '/' sy-datum(4)
        '&&' sy-uzeit(2) ':' sy-uzeit+2(2)
        INTO ls_line-info.
      REPLACE '&&' WITH '  ' INTO ls_line-info.
      APPEND ls_line TO e04_lt_top_of_page.
    ENDFORM.
    FORM alv_user_command USING r_comm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      IF r_comm = '&IC1' .
        IF rs_selfield-fieldname EQ 'KDAUF'.
          READ TABLE imseg INDEX rs_selfield-tabindex.
          SET PARAMETER ID 'AUN' FIELD imseg-kdauf.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN .
        ENDIF.
      ENDIF.
    ENDFORM.
    FORM standard USING rt_extab TYPE slis_t_extab .
      SET PF-STATUS 'STANDARD' ."excluding rt_extab.
    ENDFORM.                    "STANDARD
    FORM top_of_page.
      DATA: header TYPE slis_t_listheader.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = header
                i_logo             = 'ENJOY'.
    ENDFORM.

    Hi Liat,
    1) Check whther you are passing the keyfields in order and also check whether are you picking fields in the same order as in the table
    2) Try  to avoid Corresponding fields.
    3) Dont use select statement in a loop
    4) Use loop at itab where instaed of checking with if in the loop
    Reward points if it is helpful
    reagrds,
    kiran i

  • Is There any way to improve the performance on this code

    Hi all can any one tell me how to improve the performance of this below code.
    Actually i need to calculate opening balance of gl account so instead of using bseg am using bsis
    So is there any way to improve this code performance.
    Any help would be appreciated.
    REPORT  ZTEMP5 NO STANDARD PAGE HEADING LINE-SIZE 190.
    data: begin of collect occurs 0,
           MONAT TYPE MONAT,
           HKONT TYPE HKONT,
           BELNR TYPE BELNR_D,
           BUDAT TYPE BUDAT,
           WRBTR TYPE WRBTR,
           SHKZG TYPE SHKZG,
           SGTXT TYPE SGTXT,
           AUFNR TYPE AUFNR_NEU,
           TOT   LIKE BSIS-WRBTR,
    end of collect.
    TYPES: BEGIN OF TY_BSIS,
           MONAT TYPE MONAT,
           HKONT TYPE HKONT,
           BELNR TYPE BELNR_D,
           BUDAT TYPE BUDAT,
           WRBTR TYPE WRBTR,
           SHKZG TYPE SHKZG,
           SGTXT TYPE SGTXT,
           AUFNR TYPE AUFNR_NEU,
    END OF TY_BSIS.
    DATA: IT_BSIS TYPE TABLE OF TY_BSIS,
          WA_BSIS TYPE TY_BSIS.
    DATA: TOT TYPE WRBTR,
          SUMA TYPE WRBTR,
          VALUE TYPE WRBTR,
          VALUE1 TYPE WRBTR.
    SELECTION-SCREEN: BEGIN OF BLOCK B1.
    PARAMETERS:  S_HKONT LIKE WA_BSIS-HKONT DEFAULT '0001460002' .
    SELECT-OPTIONS: S_BUDAT FOR WA_BSIS-BUDAT,
                    S_AUFNR FOR WA_BSIS-AUFNR DEFAULT '200020',
                    S_BELNR FOR WA_BSIS-BELNR.
    SELECTION-SCREEN: END OF BLOCK B1.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-NAME = 'S_HKONT'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    START-OF-SELECTION.
      SELECT MONAT
             HKONT
             BELNR
             BUDAT
             WRBTR
             SHKZG
             SGTXT
             AUFNR
             FROM BSIS
             INTO TABLE IT_BSIS
             WHERE HKONT EQ S_HKONT
             AND   BELNR IN S_BELNR
             AND   BUDAT IN S_BUDAT
             AND   AUFNR IN S_AUFNR.
    *  if sy-subrc <> 0.
    *    message 'No Data' type 'I'.
    *  endif.
      SELECT SUM( WRBTR )
             FROM BSIS
             INTO COLLECT-TOT
             WHERE HKONT EQ S_HKONT
             AND BUDAT < S_BUDAT-LOW
             AND AUFNR IN S_AUFNR.
    END-OF-SELECTION.
      CLEAR: S_BUDAT, S_AUFNR, S_BELNR, S_HKONT.
      LOOP AT IT_BSIS INTO WA_BSIS.
    IF wa_bsis-SHKZG = 'H'.
       wa_bsis-WRBTR = 0 - wa_bsis-WRBTR.
    ENDIF.
        collect-MONAT  = wa_bsis-monat.
        collect-HKONT  = wa_bsis-hkont.
        collect-BELNR  = wa_bsis-belnr.
        collect-BUDAT  = wa_bsis-budat.
        collect-WRBTR  = wa_bsis-wrbtr.
        collect-SHKZG  = wa_bsis-shkzg.
        collect-SGTXT  = wa_bsis-sgtxt.
        collect-AUFNR  = wa_bsis-aufnr.
        collect collect into  collect.
        CLEAR: COLLECT, WA_BSIS.
      ENDLOOP.
      LOOP AT COLLECT.
        AT end of HKONT.
          WRITE:/65 'OpeningBalance',
                 85  collect-tot.
          skip 1.
        ENDAT.
        WRITE:/06 COLLECT-BELNR,
               22 COLLECT-BUDAT,
               32 COLLECT-WRBTR,
               54 COLLECT-SGTXT.
        AT end of MONAT.
          SUM.
          WRITE:/ COLLECT-MONAT COLOR 1.
          WRITE:32 COLLECT-WRBTR COLOR 1.
          VALUE = COLLECT-WRBTR.
          SKIP 1.
        ENDAT.
        VALUE1 = COLLECT-TOT +  VALUE.
        AT end of MONAT.
          WRITE:85 VALUE1.
        ENDAT.
      endloop.
      CLEAR: COLLECT, SUMA, VALUE, VALUE1.
    TOP-OF-PAGE.
      WRITE:/06 'Doc No',
             22 'Post Date',
             39 'Amount',
             54 'Text'.
    Moderator message : See the Sticky threads (related for performance tuning) in this forum. Thread locked.
    Edited by: Vinod Kumar on Oct 13, 2011 11:12 AM

    Hi Ben,
    both BSIS selects would become faster if you can add Company Code BUKRS as 1st field of WHERE clause, because it's the 1st field of primary key and HKONT is the 2nd field of primary key.
    If you have no table index with HKONT as 1st field it's a full database access.
    If possible, try to add BUKRS as 1st field of WHERE clause, otherwise ask for an additional BSIS index at your basis team.
    Regards,
    Klaus

  • Regarding performance issue in time dependent hierarchie.

    hai
    we are loading time dependent hierarchies from flatfile to bw,it is weekely load,we have nearly one million records loaded,we got an issues regarding change of these hierarchies timely.when ever there occurs a change in hierarchy a new row is added to the table,it is degrading the performance,can any one of you please suggest  how to over come performance related issues regarding time dependent hierarchies.
    Regards
    Srinivas.G

    hello deven,
    if you are only focusing on your application's performance
    on the aspect of usability i.e. less waiting time, fast
    response UI, i would personally suggest you to use AJAX.
    put some processing part on the browser side and making
    data retrieval from MI asynchronous... this way, your user
    don't have to wait for all data to be presented, but rather
    could work on the data presented in pieces (i.e. asynchronously).
    anyway try googling for AJAX...
    regards
    jo

  • Regarding performance of a report

    Hi friends,
    In the loop statement I am using modify statement for updating the data in the internal table .
    I have to improve the performance of a report.
    is there any alternative for Improving teh performance.,
    Regards,
    Jayan

    HI
    If u r modifying Ztable no probelm  because we will be having small amount of data .
    IF u r updating standard table Do like below .
    First collect all the records which you want to update to table into one internal table .
    Then update the table with that internal table ..
    IT will be better when you are updating standard table .
    I think this will  help you ..
    If u r not understood copy paste ur code i can solve ur probelm ...

  • Regarding Coherence Network Performance test?

    Hi,
    We have performed the datagram tests for two servers that we have using the coherence datagram test scripts.
    We have shared the results that we got after a run of 60 – 65 seconds each for the unidirectional and bidirectional tests.
    Please refer to
    https://docs.google.com/spreadsheet/ccc?key=0Atn1ma-myp6ndEc0THBKRTFDSnBaN0NqV1o1Ym1jRnc#gid=0
    for the results.But we want to understand from these results if this performance is under the agreeable range, for which we don’t have any absolute references with us.
    Can someone suggest if this network performance is good enough or if there are any problems based on these statistics?
    Quick help much appreciated. Thanks in advance.
    Edited by: saiyansharwan on Jan 11, 2012 5:40 AM

    Appreciate your response much. For your reference I am putitng the details on the excel sheet right on the reply.
    For unidirectional test
    =============
    Test Parameters -
    1     Buffersize     89 (Changed as exception occurred due to OS buffer size limitations)
    2     Packet size     1468 (default size adopted)
    3     Command on Server A     sh datagram-test.sh serverb
    4     Command on Server B     sh datagram-test.sh -rxBufferSize 89 ( to limit the receive buffer size assumed by coherence to match with the actual value in the OS.)
    Results:
    Server A as publisher and Server B as listener          
    Publisher Details     Byte transfer rate for Server A     111 MB/sec
         Packet transfer rate for Server A     79550 packets/sec
    Listener Details
    Sl.No     Parameter     Server B values
    1     elapsed     61547ms
    2     packet size     1468 packets
    3     throughput     111 MB/sec
              79614 packets/sec
    4     received     4900000 of 4902366
    5     missing     2366 packets
    6     success rate     0.9995174
    7     out of order     0
    8     avg offset     0
    9     gaps     802
    10     avg gap size     2
    11     avg gap time     0ms
    12     avg ack time     -1.0E-6ms; acks 0
    For Bidirectional test
    ============
    Test Parameters -
    Sl.No     Parameters     Values     Remarks
    1     Buffersize     89     Changed as exception occurred due to OS buffer size limitations
    2     Packet size     1468     default size adopted
    3     Command on Server A     sh datagram-test.sh -polite serverb -rxBufferSize 89     started on polite mode to wait till it receives data
    4     Command on Server B     sh datagram-test.sh servera -rxBufferSize 89     
    Results:
    Publisher Details
         Byte transfer rate for Server A     114 MB/sec
         Packet transfer rate for Server A     81367 packets/sec
         Byte transfer rate for Server B     84 MB/sec
         Packet transfer rate for Server B     59768 packets/sec
    Listener Details
    Sl.No     Parameter          Server A               Server B
    1     elapsed          65037ms               64932ms
    2     packet size          1468 packets          1468 packets
    3     throughput          107 MB/sec               65 MB/sec
                   76618 packets/sec          46202 packets/sec
    4     received          4982987 of 5050738          3000000 of 3001389
    5     missing          67751 packets          1389 packets
    6     success rate          0.9865859               0.9995372
    7     out of order          0               0
    8     avg offset          0               0
    9     gaps          20097               119
    10     avg gap size          3               11
    11     avg gap time     0ms               0ms
    12     avg ack time          1.149157ms; acks 309602     1.169717ms; acks 1017381
    As you may observe, unlike the test you performed, bidirectional tests are showing much better success rate in this case.
    But what I was looking for was some standards to compare against to decide if these statistics indicate good network performance.
    Any suggestions?
    Best Regards.

  • Regarding file performance

    hi,,
    i have encrypted and decrypted a file with DES/EBC/PKCS5Padding
    1)Now i wanna check its performance i.e how much time it is taking to encrypt and decrypt
    2)when it is done now i have check it for other padding and modes also
    by placing the different algorithms,modes,and padding
    so can anyone plz give me a sample code for the performance of any algoritm or a rough idea where i have to start
    and mind u plz convert the string into bytes bsforte u proceed
    If anyone wants the sample code for encrypt and decrypt a file

    and mind u plz convert the string into bytes bsforte
    u proceedWhy? If you are dealing with files it is normally better to use CipherInputStream and CipherOutputStream.
    >
    If anyone wants the sample code for encrypt and
    decrypt a fileHas been published in this forum hundreds of times.

  • Performance Issue - Fetching latest date from a507 table

    Hi All,
    I am fetching data from A507 table for material and batch combination. I want to fetch the latest record based on the value of field DATBI. I have written the code as follows. But in the select query its taking more time. I dont want to write any condition in where claue for DATBI field because I have already tried with that option.
    SELECT kschl
               matnr
               charg
               datbi
               knumh
        FROM a507
        INTO TABLE it_a507
        FOR ALL ENTRIES IN lit_mch1
        WHERE kschl = 'ZMRP'
        AND   matnr = lit_mch1-matnr
        AND   charg = lit_mch1-charg.
    SORT it_a507 BY kschl matnr charg datbi DESCENDING.
      DELETE ADJACENT DUPLICATES FROM it_a507 COMPARING kschl matnr charg.

    Hi,
    These kind of tables will be storing large volumes of data. Thus while making a select on it, its important to use as many primary key fields as possible in the where condition. Here you can try mentioning KAPPL since its specific to a requirement. If its for purchasing use 'M' and try.
    if not lit_mch1[] is initial.
    SELECT kschl
    matnr
    charg
    datbi
    knumh
    FROM a507
    INTO TABLE it_a507
    FOR ALL ENTRIES IN lit_mch1
    WHERE kappl = 'M'
    AND kschl = 'ZMRP'
    AND matnr = lit_mch1-matnr
    AND charg = lit_mch1-charg.
    endif.
    SORT it_a507 BY kschl matnr charg datbi DESCENDING.
    DELETE ADJACENT DUPLICATES FROM it_a507 COMPARING kschl matnr charg.
    This should considerably increase the performance
    Regards,
    Vik

Maybe you are looking for