Vous êtes sur la page 1sur 53
WTS520 ABAP/4 Performance Tuning (NA) Preface Unit 1: Unit2: Copyright [ABAPIA Development WB Curcutam Pas (NA) Conese Prefice Review of Table Types Transparent Tables Poot Tabs Chuser ables [ABAPY Chister tables Optimizing SQL Read Accesses Unit Objectives rerio = Read VBAK dat Solution for exercne 17 (Client/Server Ateiecure and ABAPM Ruttine (Cent Server Architecture and ABA Runtine (2) (Cent Server Architecture and ABAPY4 Runine (3) SOL Trae = hse st SQL Trace - explained statement Index Range Sean Access by RowID SELECT * FROM table SELECT FROM TABLE... EXIT SELECT * and logical databses Logical databases & TABLES statements Carsor Caching Exercise = remie [Exercise 2- Read VBAK-VBELN:9(1) (CHECK inside SELECT ~ ENDSELECT Exerite 3 - Read sol to party information Deplicte (master) Data Accesses [Beret ¢- Read Based upon mame of orderer ‘SELECTs on Fields Without Index Guielns for Index Design [BrazeeAnalysis for Table ndoses SELECT FROM TABLE ORDER BY SELECT & APPEND vs, SELECT INTO TABLE Exercise 5 Read VBAK & VBAP ta Database Jone - Oster Jin Database Joins - mer Join Dulthve Views Instead of Nested SELECTS SELECT forall enries ve. nesed SELECT Bxeoie S rewrite Exercise 6 Simmatons Calelations SELECT SUM, AVG, MIN, MAX vs. ABAP Cueulstions SELECT without WHERE condition SQL & Table Buffering ‘Unit2 Objectives ‘Table Buffering ~ Concept ‘Table Butfring Why? Buffering Types Buffer Synchronization ‘Ble Syncronizatio Buffer Synchronization Invaidition of Bafered Envi When o Buffer Table? How to Butera Table SQL Statements Bypassing the Table Bater Unit 3: Updates / Deletes / Commits Unit3 Objectives Exercise 7- Updating records ina able ‘Upaiting Recordin Table Deleting Records rom a Table Missing COMMIT WORK in reports hat inserVupdatadeles Unit 4: Processing internal tables ‘Units Objectives (Occurs parameter [READ TABLE ITAB WITH KEY.vs READ TABLE WITH KEY. binary see READ TABLE ITAB WITH KEY, READ TABLE ITAB WITH KEY. bir sear Reading Large Internal Tables without ising BINARY SEARCH Nested loops Looping a ltrs Tables “Moving Duta fom Ineoal Table ofr Tabled “Appending Data rom It. Table to Int Table? ‘Moding Dat in internal Tables Detetiag Data fom Zavemal Tables Deleting Duplicate Entries fom an Ines! Table Filing Inert Table vie COLLECT I> Unit 5: Case Study ‘Unit 5: Case Sad (2) Appendix "ABAAI« Tuning Chess - Par ‘ABAP/ Tuning Checklist Pat It /ABAPIA Tuning Checklist Par I Index fr WTS30 workshop WT520 ABAP/4 Performance Tuning (NA) Copyright Copyright 1997 SAP AG. Allrights reserved. Neither this training manual nor any part thereof may be copied or reproduced in any form or by any means, or translated into another language, without the prior consent of SAP AG. The information contained in this document is subject to change and supplement without prior notic All rights reserved. r SSAP and the SAP logo are registered trademarks of SAP AG. | MS-DOS and Excel are registered trademarks of Microsoft. 1 08? CICS, MVS ACF/VTAM, VSE and AIX are registered trademarks of IBM. 1 X Window System i registered trademark of MIT University. 1» SINIX, UTM and BS2000 are registred trademarks of Siemens "= UNIX is registred trademark of AT&T 1 HP-UX is a registered trademark of Hewlet Packard, 1 DECnet, DECstation, DECsystem, VAXstation and VMS ae registered trademarks of DEC 1 themet is registered trademark ofthe Xerox Corporation. SQL, SQL*+ PRO*C are registered trademarks ofthe ORACLE Corporation, # INFORMIX-OnLine and INFORMIX-ESQUC are registred trademarks ofthe INFORMIX Corporation = ORACI “ABAP/4 Development Workbench Introduction to oon (ease [scavs Samara Tease sons) Contents Preface and Review Optimizing SAL Read Accesses ‘SQL & Table Buffering Updates/Deletes/Commits Processing Internal Tables Case Study Exercises & Solutions - Within Unit Appendix - Tuning Checklist Alphabetical indox Preface Review of Table Types Transparent tablos Pool tables Cluster tables ABAP/4 cluster tables Transparent tables DDIC layer table VBAK [MANDT VBELN AUA BNAME KUNNR MANDT VBELN AUART BNAME KUNNR) DB layor table VBAK il 1 Transpareat ables are mapped field by field from the data ditionry tothe database ‘= For each fold inthe daa dictionary there isa corresponding field in the physical database layer 1 Transparent ables can be buffered ' Transparent tables support all open and native SQL command accesses "= Queries using non-key fields can be supported via secondary” indexes 1 External programs can read data in transparent tables ' Transparent ables should always be used for storing transaction type data (ta that is reated/changed deleted ona constant basis Pool tables DDIC layer tables TAUUM & TVAKZ MANDT SPRAS AUART AUART_SPR oot TA___OR MANDT VKORG VTWEG SPART AUART GGANBEGDAT 004 0001 ot on TA 19970104 TABNAME VARKEY DATALN VARDATA TAUUM — OO1ETA 2 oR TVAKZ __00100010101TA 8 19970101 DB layer table pool ATAB ‘The tables TAUUM (language dependent sles document types) and TVAKZ (allowed sales order 'ypes per sles organization) are both defined as poo! tables belonging tothe table pool ATAB With pool bles many abe definitions inthe data detionary ean be mapped to one physical table definition inthe database layer (ato | relationship) ‘The frst key field ofthe physical table i the table name. This eld wil contain the name ofthe DDIC table definition. ll other key fields fom the DDIC definition are mapped ito a single Fed called VARKEY. Similarly all DDIC non-key fields are mapped int o single eld on he database: VARDATA Indexes can not be creed for pool tables External programs ean NOT interpret the data in pool tables 'SQL column selects canbe programmed but the system always has to retrieve a complete record since the data is hidden in VARDATA Pool tables should mostly be used for customizing tables that are buffered andlor customizing tables tha are mostly accessed via primary key ‘The concept of pool tables was intaly designed because of limitations ofthe physica database systems, e.g. the XYZ database allowed only the creation of 10,000 tables whereas SAP had over 530,000 tables that needed to be mapped to the physical database system Cluster tables DDIC layer tables BSEC & BSEG MANOT BUKRS BELNR GJAHR BUZEI NAME1 NAME2 001 0001 44000130 1997 001 Test! _Test2 MANOT BUKRS BELNR GJAHR BUZEI BUZID AUGDT 001 0001 11000130 1997 001M __19970801 MANDT BUKRS BELNR GJAHR PAGENO TIMEGTMP PAGELG VARDATA 001 o0ot__sn000%50 wero soorosor224654 19 __ Tost) Tostzms007. DB layer cluster table RFBLG = Custer tables combine the data from several tables with identical (r almost identical) key into one physical record on the database Data is writen tothe database in compressed form ‘Retvival of data is very fast ifthe primary key i known Retrieval becomes very slow if 8 query against a cluster table (.g BSEG) is made via non-key fields is not possible to crete indexes for cluster tables CColuma selects can be programmed, however the system alway’ has to retrieve the complete data record fom the database (since all non-Key fields are lumped together in VARDATA) > performence problem ‘Advanced SQL commands like SUM, AVG, MIN, MAK ean not be used Buffering of cluster tables isnot supported ‘External programs ean NOT interpret the data in cluster tables Customers should not we cluster tables when defining new tables in their syteu ABAP/4 Cluster tables DDIC layer table INDX GLusTR cLUsTD | ‘aioe A See SR CUTE quero | [MANDT RELID SRTFD SRTF2 DB layer table INDX ‘= ABAD/4 cluster tables are defined inthe data dictionary as transparent ables 1 Table INDX.is an ABAP4 cluster table that is delivered withthe system External programs can NOT interpret the data in an ABA cluster table Special language elements EXPORT TO DATABASE, IMPORT FROM DATABASE, DELETE. FROM DATABASE ae used to process data in ABAP/4 cluster tables 1» Single fields, internal tables, fed strings or combinations ofthese elements canbe stored in ABAP/4 cluster tables 12 ABAPIA cluster tables allow the storage of mult dimensional objects (tables imide of tables) 1 ABAPY4 cluster tables are very fast when packages of data need ta be processed 1s ABAD/4chutr tables are not useful individual felds or records need tobe selected 1 Check ou the sample program ZSTUN99Y for an example of how to program accesses to ABAP/4 caster ta Unit 2 - SQL & Table Buffering © Whatis table buffering 7 © Why do you want to use table buffering 7 © What do you have to watch out for when you program SQL accesses against buffered tables Unit 2 - Objectives Describe table buffering and its impact on runtime Identify SQL statements that bypass the table buffering mechanism Run performance monitoring tools to decide if table buffering works efficiently Run performance monitoring tools to decide if tables should be buffered or not Table Buffering - Concept Table buffer Sequence of events 1) User requests execution of an ABAP program on the presentation sever (PC). The request i passed to the application server the ser is connected to 2) The applicaten server executes the ABAP program and interprets the SOL commands. Ifthe DDIC definition of stable indicates table buffering the aplication server queries ts Iocl table buffet to see ‘ifthe able (or portions ofthe table) have already been loaded, 3) Ifthe table has not been loaded into the buffer yet the system passes «request tothe database server to retrieve the required data 4) The database server passes the data hack tothe application server and the table be is illed 5) The result ofthe report processing is passed back to the presentation server + To analyze the buffering of tables use thecal statistics function: Transaction STV2> deal analysis ‘menu > Call Statistics (ables). This function can help you determine if customer developed tables are bulTered properly (what 2* or Y* tables are inthe system, are they buffered, how often ae they changed 7) o analyze the buffering quality of tables that sre buffered use transaction S02 double cick on Tables (generic key) click on pusvbton‘Bufered Objects Table Buffering - Why ? (Table butter eee 1 Using able buffers can considerably reduce the time itakes to retrieve resort 1 Retricving a single record fm TOO} from the database can take between 8 - 600 microseconds, ‘whereas the same rocord ean beretreved from the table buffer within 0.2 6 microsooonds Buffering Types 1» Thore are three basic buffering types: ‘+ Resident bufering (100%): the contents ofthe whole table is loaded ito the baer om the ist, ‘access to any data from the table ' Gneric buffering: generic key first key felis) is specified when maintaining the technical ‘stings. Tis generic key divides the contents ofthe table into so-called generic areas. When accessing any data with a specified generic ky, the whole generic area is loaded into the buffer. ‘The figure shows the case of generic bufering with one and two fields as yenerc key. ‘A very typical case of generic buffering is the client dependent buffering (lint isthe fist key field. When specifying resident buffering fora clen-dependent table the ABAP/t Dictionary automatically uses generie buffering with one key fed «Paral buffering (singe ecord): only single records at read from the database and stored inthe buffer. Buffer Synchronization | 1» What happens when a buffered table is updated (inserted, deleted)? ‘= The updates performed onthe database table and in some way also on the ble. The exact buffer handling depends an the type ofthe buffer. Either the bulTris update, or the contents are simply, rarked 2s invalid (they wil be sead on the next access), Buffer Synchronization II + Incase of more than one application sever, the buffer of application server B isnot updated immediatly. 1 Tho updating statement is executed by the R DBIF (Database Interface) which insets a record into the table DDLOG indicating the change onthe table TOO, Buffer Synchronization III jor synchronization occurs each 1-2 minutes Butter ie Invaldated ‘= Each application server (in our example B) reads periodically the contents of DDLOG i order to invalidate the contents of its buffer if necessary. ‘= The period forthe synchronization is usually 1 or 2 minutes (profile parameter) 1 Within this period, users on pplication server B read the ‘old! data. Fist forthe buffer synchronization, the data is matked as invalid and reread agnin onthe rext acces, invalidation of Buffered Entries © Resident (100%) buffered tables: ‘Any change invalidates the buffered table © Generic buffered tables: Most changes invalidate the corresponding generic area(s) © Partially buffered tables (single records! mode invalidates one buffered record Invalidate the whole tablo 1 The granularity of invalidation depends on the buffering type in work area mode, the header line ofa table (work area is used transfer data .g.'UPDATE dbab, wire diab hasbeen defined as TABLES dab When to Buffer a Table 2? © A table should be buffered when it is = rather smail in size (few number of rows or few columns with small field tength) = accessed mostly for read purposé changed very infrequently (once a day, once a month ..) © Tables that are good candidates for buffering = contro! tables/customizing tables . aster data tables (100 material master records -> few changes) How to Buffer a Table © How to turn buffering on/off ‘Dictionary maintenance (SE11 > technical settings) 1 Technical settings for a table (transaction SE13) ‘© Decide on the buffering type = ful (resident = 100%) 1 generic (with number of key fields for the generte key) 1 single records (partial butfering) + The most important question is: ea table bulferble? This canbe answered with yes ifthe table fs read:mostly and iit is acceptable that changes on this table ae ot immediatly visible on all application servers + The buffering type can only be decided based onthe access profile om thie table. In most cases this should be known tothe programmer ofthe table and thus, one ofthe settings parti, generic a resident should be set. For some special cases a now type installation-dependent is introduced. I this set, the ‘ables intlly not buffered but canbe set to one ofthe above types in the running sytem. SQL Statements Bypassing the Table Buffer SELECT ... BYPASSING BUFFER SELECT trom database views (projection views are ok) SELECT... DISTINCT SELECT ... COUNT, SUM, AVG, MIN, MAX SELECT ... FOR UPDATE WHERE clause contains IS NULL statement Native SQL statements (EXEC SQL. ... ENDEXEC) Avoid these statements when working with buffered tables | . . ° . © SELECT ... ORDER BY (other than the primary key) . . ° . Unit 3 - Updates/Deletes/Commits © Updating records in a table © Deleting records from a table © Commit work & rollback work Unit 3 - Objectives © Know the importance of the COMMIT WORK & ROLLBACK WORK statements Exercise 7 - Updating records in a table © Write a new report: ZSTUNXxG © This report should update all rows in table ZVBAK where the field VBELN (order number) is equal to the order number(s) that were entered on the selection screen via a select option Update the value in the field VKBUR (sales office) with a new value specified on the selection screen via PARAMETERS: PAR1 LIKE ZVBAK-VKBUR Updating Records in a Table PARAMETERS: VKBUR_PA LIKE ZVBAK.VKBUR, ‘SELECT * FROM ZVBAK WHERE VBELN IN VBELN_SO. ‘ZVBAK-VKBUR = VKBUR_PA. UPDATE ZVBAK. ENDSELECT | SY-SUBRG = 8, COMMIT WORK. ELSE, ROLLBACK WORK. ENDIF INSTEAD USE UPDATE 2VBAK SETVKBUR = VKBUR_PA WHERE VBELN IN VBELN_SO. f | SY-SUBRC=0, COMMIT WORK. ELSE. ROLLBACK WORK. ENDIF Runtime comparison mSELECT UPD oe, TT | — 0.00 70 1 Runtime comparison is based upon the update of 1000 records in ZVBAK (which is an exact copy of VBAK) Deleting Records from a Table SELECT * FROM ZVBAK WHERE VBELN IN VBELN_SO. DELETE ZVBAK. ENDSELECT. INSTEAD USE DELETE FROM ZVBAK WHERE VBELN IN VBELN_SO. \F 8Y-SUBRC =0, COMMIT WORK. ELSE, ROLLBACK WORK. ENDIF. /| Runtime comparison ‘= Runtime comparison i based upon deleting 1000 recor fom table ZVBAK, 1 The first coding block shows “worst” ease scenario for programming a delet logic. Fist the dtabase server bas to select ll the dats records that match the selection criteria and mave them across the ‘network tothe application server, Then the application server sends the same data back aross the network to the database server without having madea single change. Then the update takes place, 1 The second coding example doesnot send any data tothe DB server excep forthe delete instruction. The database server caries oxt the delete and passes back a returncode. No application data was transferred between application server and database server a all! Missing COMMIT WORK in reports that insert/update/delete table entries ‘> ABAP reports that issue INSERT, UPDATE or DELETE commands have to Issue COMMIT WORK statoments aftor a logical unit of work ts completed. Missing COMMITs can lead to bottlenecks on the DB side because the database systom has to keep track of the table changes via rollback ‘segments (In order to enal commit).Rollback segments can lead to overflows of th systom holds locks on the changed records that are not released untit COMMIT time yr Unit 4 - Processing internal tables Reading/filling internal tables Moving data between internal tables with the same structure Counting the number of records in an internal table that satisfy a certain WHERE condition Deleting data from internal tables Unit 4 - Objectives Speed up the retrieval of data from internal tables by using various additions to the READ TABLE command Move data between internal tables with the same structure more efficiently More efficiently count the number of rows in an internal table that satisfy a certain WHERE condition Delete records quickly from an internal table that satisfy a certain WHERE condition Describe the performance of the COLLECT statement = OCCURS Parameter 2. What should the occurs parameter be 7 vo 100 333 1000 ed I you don’t know how big the table will et, oF i you ae certain thatthe table willbe > 8K in size (sow width * expected numberof entries > 8000) use OCCURS 0. Ifyou know for sire thatthe table willbe < BK in size use your best guess for how many records the ‘ble wil hold ar ny pont In time and make thar the OCCURS parameter ‘Tho systom allocates memory in 8K blocks. If the table i bigger than 8K OCCURS 0 means thatthe ‘memory manager will allocate BK blocks of extended memory as neoded (when the table i filled) If the tble sles than 8K using OCCURS 0 would mean that at least 8K of memory i llocted to the table but will never be used. Memory i esentally wasted, Using an appropriate OCCURS. parameter means tht the system will allocate oll memory instead of extended memory inthe amount needed READ TABLE ITAB WITH KEY ... versus READ TABLE ITAB WITH KEY ... binary search READ TABLETTAB WITH KEY “998 READ TABLE TAB | WITH KEY 9998" BINARY SEARCH. | Bow Soodyaas Exxon Spett er Euront 4 READ TABLE ITAB WITH KEY ... WITH KEY Daw ‘Goodyear Exxon ‘Sequential search of the table until the record with the specified key is found. If no record with the specified key exists the entire table is read. READ TABLE. WITH KEY \ARY SEARCH. READ TABLE ITAB WITH KEY ... binary search ] [A rosa with binary humeks unt the record with th arch bisects the table into smal specified key fs found (or not) [F000 se me Vee [iaea ee $965 Dail Reading Large Internal Tables without using BINARY SEARCH DATA: FT400 LIKE T100 OCCURS 0. SELECT * FROM 1100 INTO TABLE IT100. DO 100 TIMES. READ TABLE IT100 WITH KEY ARBGB = ‘V1’. ENDDO. INSTEAD USE DO 100 TIMES. READ TABLE IT100 WITH KEY ARBGB = ‘V1". BINARY SEARCH (TRANSPORTING NO FIELDS). ENDDO. Runtime comparison ‘= Runtime comparison is based upon an intemal able containing 100,000 ents where 100 entries are retrieved via READ TABLE... the enties tobe found are records 90,000 - 90,100) 1 In order for he READ TABLE .. BINARY SEARCH to work propery the table must be sorted in ascending onder ofthe seach riteria, 1 Ifyou only want to verify the existence of record but don’t noed ay ofthe fields from the record then use the faster variant: READ TABLE .. BINARY SEARCH TRANSPORTING NO FIELDS + Ifyou don’t ned all fields from the internal table for processing thea us he variant READ TABLE ... BINARY SEARCH TRANSPORTING {1 1... (where, are the fed names from the internal able that you need) w= In Release 22. the search field(s) must be the leftmost fields ofthe internal able 1 In Release 30 the search field(s) can be any ofthe fields ofthe table Nested Loops DATA: _IVBAK LIKE VBAK OCCURS 0, IVBAP LIKE VBAP OCCURS 0. ‘SORT: IVBAK BY VBELN, IVBAP BY VBELN. LOOP AT IVBAK LOOP AT IVBAP WHERE VBELN = VBAK-VBELN. WRITE: | IVBAK-VBELN, IVBAP-VBPOS, ENDLOOP. ENDLOOP. INSTEAD USE Loop AT Ivak. READ TABLE IVBAP WITH KEY VBELN = IVBAK-VBELN BINARY SEARCH TRANSPORTING NO FIELDS, LOOP ATIVBAP FROM SY-TABIX, IF IVBAP-VBELN <> IVBAK-VBELN. EXIT. ENDIF. WRITE: / IVBAK-VBELN, IVBAP-VBPOS, ENDLOOP. f= Nested loops with a WHERE condition onthe inner table should only be used ifthe inner tables very small. = ALOOP ATITAB WHERE means that only those records that match the WHERE condition will be processed within the LOOP ENDLOOP statement sequence. However, internally the sytem will loop ‘hyough “ALL" records in the table o fin the ones that match the WHERE condition 1 IFtable IVBAK contains 5,000 records and table IVBAP contains 20,000 records the nested LOOP with WHERE condition takes approx. $ minutes to proces (the system has to go through 5000 loops ‘on IVBAK + 5000 * 20,000 = 100,000,000 loops on IVBAP). The LOOPIREAD BINARY SEARCHILOOP combination takes approx. 15 seconds !! Looping at Internal Tables > Ifyou are looping at an internal table just to count the number of records that fulfill certain criteria then use the following variant of the loop statemen’ LOOP AT IVBAK TRANSPORTING NO FIELDS WHERE BNAME = ‘Smith’, ADD 1 TO COUNTER. ENDLOOP. a | 1 The same applies if you only want o verity if atleast one record exist that satisfies a certain condition = LOOP AT IVBAK TRANSPORTING NO FIELDS WHERE VBELN> ‘0300000100" EXIT. ENDLOOP. IF SY-SUBRC 0. + Condition is rue ENDIF. Moving Data from Internal Table to Internal Table2 DATA: ITAB4 LIKE VBAK OCCURS 100 WITH HEADER LINE, ITAB2 LIKE VBAK OCCURS 100 WITH HEADER LINE. REFRESH ITAB2. LOOP ATITAB1. MOVE ITAB1 TO ITAB2. APPEND ITAB2. ENDLOOP. INSTEAD USE ITAB2[]= ITAB1[] ‘= This technique only works for internal table that have exactly the same structure Appending Data from Int. Table( to Int. Table2 DATA: ITAB4 LIKE VBAK OCCURS 100 WITH HEADER LINE, ITAB2 LIKE VBAK OCCURS 100 WITH HEADER LINE. LOOP ATITAB1. MOVE ITAB1 TO ITAB2. APPEND ITAB2. ENDLOOP. INSTEAD USE APPEND LINES OF ITAB1 TO ITAB2 Modifying Data in Internal Tables DATA: IZVBAK LIKE ZVBAK OCCURS 0 WITH HEADER LINE. PARAMETERS: VKBUR_PA LIKE ZVBAK-VKBUR. SELECT * FROM ZVBAK INTO TABLE IZVBAK UP TO 100 ROWS. LOOP ATIZVBAK. IZVBAK-VKBUR = VKBUR_PA. MODIFY IZVBAK. ENDLOOP. INSTEAD USE LOOP AT IZVBAK. IZVBAK-VKBUR = VKBUR_PA. MODIFY IZVBAK TRANSPORTING VKBUR. ENDLOOP. = Deleting Data from Internal Tables ‘a loop construct to do i LOOP AT IVBAK WHERE BNAME = ‘Smith’. DELETE IVBAK. ENDLOOP. INSTEAD USE DELETE IVBAK WHERE BNAME = ‘Smith’. Deleting Duplicate Entries from an Internal Table ntries from an internal table the table has to be sorted by the fields used in the comparing condi > If there is no comparing condition the table should be sorted by all fields DELETE ADJACENT DUPLICATES FROM ITAB [COMPARING FIELD1 FIELD2 ... FIELDn}. Filling Internal Tables via COLLECT Itab > The system uses a hash algorithm to determine the key of an internal table record when using COLLECT statements > The following commands invalidate the hashing search procedure and switch to a sequential search method which will considerably slow down the performance of the COLLECT statement > APPEND, INSERT, MODIFY, DELETE, SORT, REFRESH} IMPORT, SELECT INTO TABLE/APPENDING TABLE > Use only COLLECT itab to fill the internal table and then carry out sortimodify/delete operations y 1 The system builds 2 hash table in main memory to process the COLLECT statement ' For each entry inthe internal table an entry of approx. 20 byte length is stored inthe hashtable ‘= Lf here is not enough memory available to store the hesh able the following effects occur: Release 2.2 > system switches from hash search 1 Tinea search Release 3.0-> program terminates wit) ertor message TABLE, HASH_NO_MEMORY 1 See OSS note 31520 Unit 5 - Case Study Rudi Ramshackle the manager of the XYZ company in Chicago has Foquested your help to resolve a performance issue at his site From August 1996 to September 1996 the execution time of the month end report 2STUNC10 has Increased from 6 minutes to 130+ minutes: ‘Analyze the report based upon the tuning methods you have Tearned about in this class. Copy ZSTUNC10 under the name ZSTUNxeH and recode It —— Unit 5 - Case Study ‘© Compare before and after runtimes. © Diecuseion on performance techniques used by students Appendix © ABAP/4 Tuning Checklist © Scoresheet for Tuning Knowledge © Index for WT520 Course Material ABAP/4 Tuning Checklist - Part I Is the program using SELECT * statements 7 @ Convert them to SELECT columnt column2 or use projection views: Are CHECK statements for table fields embedded in a SELECT ... ENDSELECT loop 7 1 Incorporate the CHECK statements Into the WHERE clause of the SELECT statement @ Do SELECTS on non-key fields use an appropriate DB index or is the table buffered ? | Greate an index for the tablo In the data dictionary or butfer tables if they are road only of read mostly @ Is the program using nested SELECTS to retrieve data? 1 Convert nested selects to database views, DB joins (4.0) or ‘SELECT xxx FOR ALL ENTRIES IN ITAB ABAP/4 Tuning Checklist - Part II files that grow constantly (BSEG, MKPF, VBAK) ? 1 Program design is wrong - Back to the drawing board @ Are SELECT accesses to master data files buffered (no duplicate accesses with the same key) ? 1 Butfer accesses to master data files by storing the data in an Internal table an¢ filing the table with the READ TABLE BINARY SEARCH method Js the program using SELECT .. APPEND ITAB .. ENDSELECT techniques to fill internal tables 7 © Change the processing to read the data immediately into an internal table (SELECT VBELN AUART... INTO TABLE IVEAK ~) @ Is the program using SELECT ORDER BY statements 7 table first and then ABAP/4 Tuning Checklist - Part Ill Is the programming doing calculations/summations that can be done on the database via SUM, AVG, MIN or MAX functions of the SELECT statement 7 use the calculation capabilities of the d via SELECT SUM, & Are internal tables processed using the READ TABLE itab WITH KEY ... BINARY SEARCH technique ? | Change table accesses to use BINARY SEARCH method Is the program inserting/updating or deleting data in ialog mode (not via an update function module) ? 12 Make sure that the program issues COMMIT WORK statements when one or more logical unlts of work (LUWs) have been processed y Index for WTS20 workshop a ABADI Chater Tales 08 ABADI tng eben Aponte “Appenting a em wob2 ‘sar B Bt. ano ble dees sat Butler Syecreiatan wea Buteeng Types 25 Ewe) 3 e ‘CHECK nse SELECT...ENDSELECT 8 {COMBAT WORK. oy (Cenerting EB Ca Suey Ped D Dambc views inne of meses SELECTS 130, Dele dipe nes fom an intemal table 13 Detsing ease Date abe is epi ate) eas ve E Excerse {-reoie Evcrce2 kxcee 3 Brome rome oui 3-reoie Bee? F ig neal oks Ma LULL 8 c T ra Moving dam om ib oak 0 N Nested Loops e o sar Patter rt P a Poot Tes o7 R [READ TABLE TAB WITH KEY as SELECT anda dtr SELECT FROM able SELECT fr lentes coe SELECTS SELECT SUM, AVG, MIN MAX SELECT witoue WHERE conan SQL stents psn the ale bur SOl.ome tae et SOL tase expand stent Upding ronda DB be

Vous aimerez peut-être aussi