 / 1 Optimize Database Access From ABAP QL.  / 2 Copyright Please note: No part of this Training Session may be reproduced or transmitted in any form.

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

SAP Performance & Tuning Bonus material for 201 ABAP Interview Questions Material code : BM02 Author.
ABAP Data/Internal Tables ITP 321 Anthony Borquez & Jim Graver.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
TURKISH STATISTICAL INSTITUTE 1 /34 SQL FUNDEMANTALS (Muscat, Oman)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Midterm Review Lecture 14b. 14 Lectures So Far 1.Introduction 2.The Relational Model 3.Disks and Files 4.Relational Algebra 5.File Org, Indexes 6.Relational.
University of Southern California Enterprise Wide Information Systems ABAP/ 4 Programming Language Instructor: Richard W. Vawter.
Chapter Physical Database Design Methodology Software & Hardware Mapping Logical Design to DBMS Physical Implementation Security Implementation Monitoring.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems More SQL Database Design -- More SQL1.
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
Information Technology in Organizations
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
Concepts of Database Management Sixth Edition
INFORMATION TECHNOLOGY IN BUSINESS AND SOCIETY SESSION 16 – SQL SEAN J. TAYLOR.
ABAP Chapter 3 Open SQL Internal Table. SAP System : 3 Tier Client/Server DB Server SAP Application Server SAP GUI Presentation Server SAP GUI.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
1 Physical Data Organization and Indexing Lecture 14.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
SAP ABAP DemoNawin's Training Acadamy1. Enterprise Wide Information Systems ABAP/ 4 Programming Language Mr. RG Nawin Krishna, Bsc(cs);Msc(psychology);MBA(HR);SAP(HCM/HR),
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
TM 7-1 Copyright © 1999 Addison Wesley Longman, Inc. Physical Database Design.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
Analyzing Data For Effective Decision Making Chapter 3.
SQL/Lesson 4/Slide 1 of 45 Using Subqueries and Managing Databases Objectives In this lesson, you will learn to: *Use subqueries * Use subqueries with.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
Microsoft ® Business Solutions–Navision ® 4.0 Development II - C/SIDE Solution Development Day 2.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
Views In some cases, it is not desirable for all users to see the entire logical model (that is, all the actual relations stored in the database.) In some.
ITEC3612 Enterprise Architecture and Resource Planning (Lab) ABAP Programming (2)
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
SQL Performance and Optimization l SQL Overview l Performance Tuning Process l SQL-Tuning –EXPLAIN PLANs –Tuning Tools –Optimizing Table Scans –Optimizing.
BACS 287 Structured Query Language 1. BACS 287 Visual Basic Table Access Visual Basic provides 2 mechanisms to access data in tables: – Record-at-a-time.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
06 | Modifying Data in SQL Server Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
ABAP Dictionary Introduction Tables in the ABAP Dictionary Performance in Table Access Consistency through Input Check Dependencies of ABAP Dictionary.
SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Session 1 Module 1: Introduction to Data Integrity
SAP DEVELOPMENT BASICS Bohuslav Tesar. TRAINING OVERVIEW Amazing life of ABAP developer ;) SAP introduction ABAP basics ABAP Reporting.
IMS 4212: Database Implementation 1 Dr. Lawrence West, Management Dept., University of Central Florida Physical Database Implementation—Topics.
A Guide to SQL, Eighth Edition Chapter Four Single-Table Queries.
CS 540 Database Management Systems
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
SAP Tuning 실무 SK㈜ ERP TFT.
ABAP Performance Tuning for SAP R/3 1 ABAP Performance Tuning.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SPECTO TRAINING contact us: , mail :
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Database Performance Tuning and Query Optimization
Physical Database Design
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
SQL Fundamentals in Three Hours
Contents Preface I Introduction Lesson Objectives I-2
Chapter 8 Advanced SQL.
Chapter 11 Database Performance Tuning and Query Optimization
Presentation transcript:

 / 1 Optimize Database Access From ABAP QL

 / 2 Copyright Please note: No part of this Training Session may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or information storage and retrieval systems, for any purpose without the express written permission of SAP America. © SAP America, All rights reserved. SAP Virtual Classroom™ is a registered trademark of SAP America.

 / 3 Course Objectives At the conclusion of this course, you will know: Five Rules for Writing an ABAP Program with Efficient Database Access. Performance Check List.

 / 4 SQL Performance of Business Transactions R/3 and DBMS Architecture Efficient Database Programming in ABAP ABAP Open SQL Overview

 / 5 General rule: The performance of a business transaction is primarily determined by its DB accesses. DB Application GUI Performance of Business Transactions

 / 6 SQL Performance of Business Transactions R/3 and DBMS Architecture Efficient Database Programming in ABAP ABAP Open SQL Overview

 / 7 R/3 Architecture Central DB (stores all data and application programs) Application server Communication from / to user Data transfer between database and application server Presentation server (workstation) Database server DBMS processes DB cache... Local data WP

 / 8 Rule-based Cost-based Execution plan The Optimizer

 / 9 SQL Performance of Business Transactions R/3 and DBMS Architecture Efficient Database Programming in ABAP ABAP Open SQL Overview

 / 10 ABAP SQL Open SQLNative SQL DB interface Embedded SQL SQL Database

 / 11 SELECT field1 field2 field3 field4 FROM ( table1 INNER JOIN table2 ON table1~field1 = table2~field1 ) WHERE... AND field1 IN ('A','B','C') AND field3 LIKE 'T%' SELECT clause WHERE clause FROM clause Search area Data to be transferred Relevant data - the hit list One or more tables Data to be searched - only limited by index access Solution Set of a SQL Command

 / 12 SQL Performance of Business Transactions R/3 and DBMS Architecture Efficient Database Programming in ABAP ABAP Open SQL Overview

 / 13 5 Rules Should be as independent of the DBMS as possible Rules for Open SQL Programming

 / 14 Rule 1: Keep the hit list small Keep the Hit List Small

 / 15 Use a WHERE clause wherever possible SELECT * FROM sflight INTO wa. CHECK wa-fldate(4) = ´1998´. WRITE: / wa-carrid, wa-connid,... ENDSELECT. SELECT * FROM sflight INTO wa WHERE fldate LIKE ´1998%´. WRITE: / wa-carrid, wa-connid,... ENDSELECT. Use instead Performance SELECT *... CHECK. ENDSELECT. 300,000 msec (for 400 recs.) advantage:SELECT... WHERE. 3,700 msec Keep the Hit List Small

 / 16 Effects of Rule 1

 / 17 Rule 2: Keep the set of data to be transferred between the database and the application small Keep the Transferred Dataset Small

 / 18 Keep the Transferred Dataset Small SELECT * FROM sbook INTO wa WHERE carrid NE 'BA'. WRITE: / wa-customid, wa-class. ENDSELECT. SELECT customid class FROM sbook INTO (wa-customid, wa-class) WHERE carrid NE 'BA'. WRITE: / wa-customid, wa-class. ENDSELECT. Performance SELECT column.... ENDSELECT. 2.2 sec (for records) advantage:SELECT *... ENDSELECT. 6.7 sec Field list vs. SELECT * Use instead

 / 19 Keep the Transferred Dataset Small SELECT carrid connid FROM sbook INTO (wa-carrid, wa-connid) WHERE carrid = 'LH'. IF sy-dbcnt > 10. EXIT. ENDIF. WRITE: / wa-carrid, wa-connid ENDSELECT. SELECT carrid connid FROM sbook UP TO 10 ROWS INTO (wa-carrid, wa-connid) WHERE carrid = 'LH'. WRITE: / wa-carrid, wa-connid,... ENDSELECT. Performance SELECT column... EXIT. ENDSELECT 300,000 msec advantage:SELECT column... UP TO 10 ROWS. 34,000 msec Use data selectively Use instead

 / 20 SELECT * FROM SBOOK REPORT XYZ Data transfer from DB server to appl. server SBOOK records each with 97 bytes required 30 transfers of 32K packages from the DB server to the appl. server Report result Appl. server Data- base server Appl. server Keep the Transferred Dataset Small Data transfer

 / 21 SELECT column1.. FROM SBOOK REPORT XYZ SBOOK records each with 9 bytes required 3 transfers of 32K packages from the DB server to the appl. server Data transfer of DB server to appl. server Report result Data- base server Appl. server Appl. server Keep the Transferred Dataset Small Data transfer

 / 22 Referencing of table fields Instead of this, use: SELECT * FROM sflight INTO wa WHERE carrid ='LH'. wa-seatsocc = wa-seatsocc + 1. UPDATE sflight FROM wa. ENDSELECT. UPDATE sflight SET seatsocc = seatsocc + 1 WHERE carrid = 'LH'. Performance advantage: SELECT *... ENDSELECT ms (for 100 records) UPDATE... SET ms Keep the Transferred Dataset Small

 / 23 Use aggregate functions sum = 0. SELECT loccuram FROM sbook INTO wa-loccuram WHERE fldate LIKE '1998%'. sum = sum + wa-loccuram. ENDSELECT. WRITE: / sum. Instead of this, use: SELECT sum( loccuram ) FROM sbook INTO sum WHERE fldate LIKE '1998%'. WRITE: / sum. Performance advantage: SELECT... sum = sum +... ENDSELECT. 3.6 sec (with 21,500 records) SELECT sum ( price ) INTO 1.1 sec Keep the Transferred Dataset Small

 / 24 Databases can calculate roundings in a different manner to the ABAP runtime system. Databases can recognize the NULL value, ABAP cannot. AVG (1, 3, 0, 0) = 1 AVG (1, 3, NULL, NULL) = 2 Select the right data type for the target field. For AVG use data type 'F' (Floating Point). For SUM use a data type which is large enough to incorporate the total so as to avoid an overflow of figures. Aggregate functions – proceed with care Keep the Transferred Dataset Small

 / 25 The "Having" clause SELECT carrid connid fldate MAX( luggweight ) INTO (carrid, connid, fldate, max) FROM sbook GROUP BY carrid connid fldate HAVING MAX( luggweight ) > 20. WRITE: / carrid, connid, fldate, max. ENDSELECT. SELECT carrid connid fldate MAX( luggweight ) INTO (carrid, connid, fldate, max) FROM sbook GROUP BY carrid connid fldate. CHECK max > 20. WRITE: / carrid, connid, fldate, max. ENDSELECT. Keep the Transferred Dataset Small

 / 26 Effects of Rule 2

 / 27 Rule 3: Keep the number of roundtrips between the database and application small Keep the Number of Roundtrips Small

 / 28 LOOP AT itab. INSERT INTO dbtab VALUES itab. ENDLOOP. INSERT dbtab FROM TABLE itab. Instead of this, use: * If double lines can appear: INSERT dbtab FROM TABLE itab ACCEPTING DUPLICATE KEYS. IF sy-subrc = Error handling... ENDIF. Array operations – for example, with INSERT Keep the Number of Roundtrips Small

 / 29 JOINs implemented as views in the ABAP Dictionary JOINs in ABAP Open SQL SELECT... FOR ALL ENTRIES SELECT * FROM t1 WHERE... SELECT * FROM t2 WHERE... SELECT * FROM t3 WHERE... SELECT * FROM t4 WHERE... SELECT * FROM t5 WHERE ENDSELECT. SELECT * FROM t6 WHERE... SELECT * FROM t7 WHERE... SELECT * FROM t8 WHERE ENDSELECT. Avoid multi-way SELECTs Keep the Number of Roundtrips Small

 / 30 View in the ABAP Dictionary SELECT * FROM sflight. SELECT * FROM sbook WHERE carrid = sflight-carrid AND connid = sflight-connid AND fldate = sflight-fldate. IF SY_SUBRC NE 0. WRITE: sbook-carrid, sbook-bookid,... ENDIF. ENDSELECT. SELECT * FROM sflightsbookview. * View im ABAP-Dictionary WRITE: / sflightsbookview-price, sflightsbookview-paymentsum,... ENDSELECT. Instead of this, use: Keep the Number of Roundtrips Small

 / 31 SELECT f~carrid f~connid b~bookid INTO (carrid, connid, bookid) FROM sflight AS f INNER JOIN sbook AS b ON f~carrid = b~carrid AND f~connid = b~connid AND f~fldate = b~fldate. WRITE: / carrid, connid, bookid. ENDSELECT. INNER JOIN in the FROM clause SELECT * FROM sflight INTO wa_sflight. SELECT * FROM sbook INTO wa_sbook WHERE carrid = wa_sflight-carrid AND connid = wa_sflight-connid AND fldate = wa_sflight-fldate. WRITE: / wa_sflight-carrid, wa_sflight-connid, wa_sbook-bookid. ENDSELECT. Instead of this, use: Keep the Number of Roundtrips Small

 / 32 Inner Join AA LH LH QF... SFLIGHT: CARRID CONNID... DISTANCE SBOOK: CARRID CONNID... BOOKID Join operator AA AA AA AA Join result table on the database CARRID CONNID... DISTANCE CARRID CONNID... BOOKID QF QF AA AA AA QF Please note: The resulting quantity does not contain any entries for the airline company LH. Keep the Number of Roundtrips Small

 / 33 SELECT f~carrid f~connid f~fldate b~bookid INTO (carrid, connid, fldate, bookid) FROM sflight AS f LEFT OUTER sbook AS b ON f~carrid = b~carrid AND f~connid = b~connid AND f~fldate = b~fldate. WRITE: / carrid, connid, fldate, bookid. ENDSELECT. SELECT * FROM sflight INTO wa_sflight. SELECT * FROM sbook INTO wa_sbook WHERE carrid = wa_sflight-carrid AND connid = wa_sflight-connid AND fldate = wa_sflight-fldate. WRITE: / wa_sflight-carrid, wa_sflight-connid, wa_sbook-bookid. ENDSELECT. IF sy-dbcnt = 0. CLEAR wa_sbook-bookid. WRITE: / wa_sflight-carrid,... wa_sbook-bookid. ENDIF. ENDSELECT. Instead of this, use: Keep the Number of Roundtrips Small LEFT OUTER JOIN in the FROM clause

 / 34 AA LH LH QF... SFLIGHT: CARRID CONNID... DISTANCE SBOOK: CARRID CONNID... BOOKID Join operator AA AA AA AA LH NULL NULL... NULL LH NULL NULL... NULL QF QF Join result table on the database CARRID CONNID... DISTANCE CARRID CONNID... BOOKID AA AA AA QF Left Outer Join Keep the Number of Roundtrips Small Please note: The resulting set always contains the complete ‘outer' table.

 / 35 Effects of Rule 3

 / 36 Rule 4: Keep the costs of the search down Keep the Search Costs Down

 / 37 TableIndex A Block 2 Block 3 Block 1 Tables and indices Record 4 Record 2 Record 5 Record 1 Record 6 Record 7 Record 3 Index B BEGBEG CDECDE ABAB FGFG Keep the Search Costs Down

 / 38 SELECT * FROM sbook WHERE carrid = 'AA' AND connid = '0017' AND fldate = ' '.... Processing... ENDSELECT. Keep the Search Costs Down Use as many EQs as possible

 / 39 SELECT carrid connid fldate bookid custtype orderdate FROM sbook INTO... WHERE carrid = 'LH' AND fldate = ' ' AND orderdate = ' '.... Verarbeitung... ENDSELECT. SELECT f~carrid f~connid f~fldate b~bookid b~custtype b~orderdate INTO (carrid, connid, fldate, bookid, custtype) FROM sflight AS f INNER JOIN sbook as b ON f~carrid = b~carrid AND f~connid = b~connid AND f~fldate = b~fldate WHERE f~carrid = 'LH‘ AND fldate = ' ' AND orderdate = ' '.... Verarbeitung... ENDSELECT. SBOOK Key: mandt carrid connid fldate bookid Use as many EQs as possible Keep the Search Costs Down

 / 40 Keep the Search Costs Down 1234 Key to the SBOOK table Primary index Mand CarridConnidFldate Mand CarridConnidFldate Secondary index Carrid FldateOrderdate

 / 41 f0 = x1 AND (f1 = y1 OR f1 = y2 OR f1 = y3). Replace the inner OR with an IN operator f0 = x1 AND f1 IN (y1, y2, y3). Keep the Search Costs Down

 / 42 Place fields that are effective in the selection process at the beginning The following fields are not effective in the selection process: MANDT, BUKRS, GJAHR. The following are effective: BUCHUNGSNUMMER, BELNR, MATNR, KUNNR, Create small indices Avoid overlaps (disjunct indices) Up to 3 indices in each table do not have to be critical Avoid using complex WHERE clauses with IN and OR operators for index fields You cannot process NOT operators in SELECT using an index Verify the use of indices (for example, SQL trace) Index design Keep the Search Costs Down

 / 43 R/3 work process DB work process Database cache Database Service processes Operating system Database files R/3 work process DB work process Network communication DB CPU consumption DB memory consumption Physical I/O Effects of Rule 4

 / 44 Rule 5: Remove the load from the database Remove the Load from the Database

 / 45 Buffer tables Avoid repeated reading of data Is a SELECT needed before a change is made? ORDER BY vs. SORT Use the “right” logical database ==> More s c a la b l e Remove the Load from the Database

 / 46 What is table buffering? When should you buffer tables? What should you bear in mind when programming SQL accesses to buffered tables? ABAP Open SQL and table buffering Remove the Load from the Database

 / 47 SELECT col FROM T001 PROGRAM XYZ RESULT Transfer data from the database server to the application server and the table buffer Read data from database if it is not in the table buffer Table buffering – the concept Remove the Load from the Database Data- base server Table buffer Appl. server

 / 48 Why buffer tables? Appl. server Data- base server SELECT SINGLE col1.. FROM T001 PROGRAMM XYZ Table buffer ms ms Remove the Load from the Database

 / 49 Buffering types key1key2key3data key1 key2key3data key1key2 key3data key1key2key3 data Full buffering (100%) Generic buffering 1 key field Generic buffering 2 key fields Single-record buffering (partial) A A B B A A B B B C D C A A A B B C C C D D D A A B B B A A A A B B B C D C A A A B B C C C C D D D D Remove the Load from the Database

 / 50 Buffer synchronization I Application server A Table buffer Communication system Database management system The database is up to date Local buffer is up to date... DDLOG UPDATE T Database R/3 DB interface Remove the Load from the Database

 / 51 Buffer synchronization II Application server A Table buffer Communication system Database management system Application server B Buffer is NOT up to date... DDLOG UPDATE T Database Table buffer R/3 DB interface DDLOG INSERT DDLOG The database is up to date Local buffer is up to date Remove the Load from the Database

 / 52 Application server AApplication server B Buffer is invalidated... SELECT DDLOG Buffer synchronization: every 1-2 minutes R/3 DB interface Buffer synchronization III Table buffer DDLOG Database DDLOG Database management system Communication system The database is up to date Local buffer is up to date Remove the Load from the Database

 / 53 key1key2key3data key1 key2key3data key1key2 key3data key1key2key3 data Full buffering (100%) Generic buffering 1 key field Generic buffering 2 key fields Single-record buffering (partial) Invalidation of the buffer Any change invalidates the buffer Changes invalidate the corresponding generic areas If there is a change in only one work area, only the one record is invalidated. Other changes invalidate the entire table. Remove the Load from the Database A A B B A A B B B C C A A C 3 3 2

 / 54 When should you buffer a table? You should buffer a table if: It is read frequently It is relatively small It is read much more frequently than it is changed Possible candidates for buffering Control tables and customizing tables “Small” master data tables (100 data records for material master data -> few changes) Remove the Load from the Database

 / 55 How is a table buffered? Where? In the technical settings in the maintenance routine of a table in the ABAP Dictionary. How? A decision that is based on the buffering type:  Fully buffered  Generic (by specifying the number of key fields for the generic key)  Single-record buffering Remove the Load from the Database

 / 56 SQL statements that bypass the table buffer SELECT... BYPASSING BUFFER SELECT... DISTINCT SELECT... COUNT, SUM, AVG, MIN, MAX SELECT... ORDER BY f1... fn SELECT... GROUP BY / HAVING SELECT... FOR UPDATE SELECT... JOIN WHERE clause contains IS NULL statement WHERE clause contains subquery Native SQL statements (EXEC SQL.... ENDEXEC) Remove the Load from the Database

 / 57 This should be avoided because: It places an unnecessary burden on the database Different results could be read Repeated reading of data Remove the Load from the Database

 / 58 ORDER BY... does not necessarily mean that certain indexes will be used in the database... often results in large overhead for the database. Is the data really needed in a certain order? ORDER BY vs. SORT Remove the Load from the Database

 / 59 Pre-defined effective table access Simplified list creation Optimization is performed centrally But use the “right” LDB! Logical databases Remove the Load from the Database

 / 60 R/3 work process DB work process Database cache Database Service processes Operating system Database files R/3 work process DB work process Network communication DB CPU consumption DB memory consumption Physical I/O Effects of Rule 5

 / 61 Performance Check List Is the program using SELECT * statements? Convert them to SELECT column 1 column 2 or use projection views. Are the fields within the SELECT..WHERE normalized to same domain? Convert data fields in where clause to same field level domain. Ex. ( SELECT FROM MARA…WHERE matnr = fld2… DATA: fld2 like mara-matnr)

 / 62 Performance Check List Are Check Statements for table fields embedded in a SELECT … ENDSELECT loop? 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? Create index for the table in the data dictionary or buffer tables if they are read only or read mostly. SELECT into ITABs on key fields, LOOP ITAB or DELETE to filter on remaining criteria.

 / 63 Performance Check List Is Program Using nested selects to retrieve data ?. Convert nested SELECT to database views or Inner joins. Are there SELECTs without WHERE condition against files that grow constantly?. Work to get as many key and non-key fields for each DB file. Select into ITAB on keys, then LOOP or DELETE ITAB to filter remaining non-key fields.

 / 64 Performance Check List Is the program using Select … Append ITAB…. ENDSELECT technique to fill Internal Table ?. Change the processing to read the data immediately into an internal table. (SELECT VBELN AUART… INTO TABLE IVBAK…) Is the program using SELECT..ORDER BY statement?. Data should be read into an internal table first and then sorted, unless there is an appropriate index for the order by field.

 / 65 Performance Check List Is the programming doing calculations/summations that can be done on the database via SUM, AVG, MIN, MAX functions for the SELECT statement?. Use the calculation capabilities of the database via SELECT SUM… Is the program inserting/updating or deleting data in dialog mode (not via an update function module)?. Make sure that the program issues COMMIT WORK statements when one or more logical units of work (LUWs) have been processed.

 / 66 Course Objectives Five Rules for Writing an ABAP Program with Efficient Database Access. Performance Check List.