ABAP Performance Tuning for SAP R/3 1 ABAP Performance Tuning.

Slides:



Advertisements
Similar presentations
Tuning Oracle SQL The Basics of Efficient SQLThe Basics of Efficient SQL Common Sense Indexing The Optimizer –Making SQL Efficient Finding Problem Queries.
Advertisements

Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
SAP Performance & Tuning Bonus material for 201 ABAP Interview Questions Material code : BM02 Author.
ABAP Data/Internal Tables ITP 321 Anthony Borquez & Jim Graver.
ABAP/4 PROGRAMMING Internal Table 講 師:呂 昇 燦 2000 年 9 月 26 日.
CS 540 Database Management Systems
DBMS 2001Notes 4.2: Hashing1 Principles of Database Management Systems 4.2: Hashing Techniques Pekka Kilpeläinen (after Stanford CS245 slide originals.
1 Query-by-Example (QBE). 2 v A “GUI” for expressing queries. –Based on the Domain Relational Calulus (DRC)! –Actually invented before GUIs. –Very convenient.
Database Management Systems 3ed, R. Ramakrishnan and Johannes Gehrke1 Evaluation of Relational Operations: Other Techniques Chapter 14, Part B.
Database Management Systems, R. Ramakrishnan and Johannes Gehrke1 Evaluation of Relational Operations: Other Techniques Chapter 12, Part B.
Database Management Systems, R. Ramakrishnan and Johannes Gehrke1 Evaluation of Relational Operations: Other Techniques Chapter 12, Part B.
 SAP AG CSU Chico Searching and Selecting Data from R/3 ABAP/4 class Gail Corbitt - Fall 1998.
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.
SQL 2 – The Sequel R&G, Chapter 5 Lecture 10. Administrivia Homework 2 assignment now available –Due a week from Sunday Midterm exam will be evening of.
1 Evaluation of Relational Operations: Other Techniques Chapter 12, Part B.
Access Path Selection in a Relation Database Management System (summarized in section 2)
ORACLE ONLINE TRAINING Contact our Support Team : SOFTNSOL India: Skype id : softnsoltrainings id:
ABAP Chapter 3 Open SQL Internal Table. SAP System : 3 Tier Client/Server DB Server SAP Application Server SAP GUI Presentation Server SAP GUI.
SAP Tuning 실무 교육
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.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Ashwani Roy Understanding Graphical Execution Plans Level 200.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
5/24/01 Leveraging SQL Server 2000 in ColdFusion Applications December 9, 2003 Chris Lomvardias SRA International
1 Chapter 14 DML Tuning. 2 DML Performance Fundamentals DML Performance is affected by: – Efficiency of WHERE clause – Amount of index maintenance – Referential.
Using Special Operators (LIKE and IN)
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
ITEC3612 Enterprise Architecture and Resource Planning (Lab) ABAP Programming (2)
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.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
Module 4 Database SQL Tuning Section 3 Application Performance.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
University of Sunderland COM 220 Lecture Ten Slide 1 Database Performance.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Database Management System. DBMS A software package that allows users to create, retrieve and modify databases. A database is a collection of related.
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.
SqlExam1Review.ppt EXAM - 1. SQL stands for -- Structured Query Language Putting a manual database on a computer ensures? Data is more current Data is.
Session 1 Module 1: Introduction to Data Integrity
Mining real world data RDBMS and SQL. Index RDBMS introduction SQL (Structured Query language)
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.
ICOM 5016 – Introduction to Database Systems Lecture 13- File Structures Dr. Bienvenido Vélez Electrical and Computer Engineering Department Slides by.
Thinking in Sets and SQL Query Logical Processing.
ERPAdmin SAP Performance Tuning
CS4432: Database Systems II
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
 / 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.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
SAP Tuning 실무 SK㈜ ERP TFT.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Tuning Oracle SQL The Basics of Efficient SQL Common Sense Indexing
MySQL Subquery Source: Dev.MySql.com
Evaluation of Relational Operations: Other Operations
Physical Database Design
Access: SQL Participation Project
CS222P: Principles of Data Management Notes #13 Set operations, Aggregation, Query Plans Instructor: Chen Li.
Diving into Query Execution Plans
Updating Databases With Open SQL
Updating Databases With Open SQL
Presentation transcript:

ABAP Performance Tuning for SAP R/3 1 ABAP Performance Tuning

ABAP Performance Tuning for SAP R/3 2 튜닝의 요소 Application Tuning 70 % (SQL, 인덱스, 뷰,JOIN,Array, 부분 처리 ) System Tuning 20 % (OS,I/O, 메모리,DBMS..) 기타 10%

ABAP Performance Tuning for SAP R/3 3 Array Mode and Workarea Mode StatementABAP <- DBIFDBIF <- DBMS INSERT, UPDATE, DELETE wawa SELECT... ENDSELECTwaarray SELECT... INTO TABLEarray INSERT, UPDATE, DELETE FROM TABLEarrayarray / wa MODIFY FROM TABLEarraywa StatementABAP -> DBIFDBIF -> DBMS SELECT... FOR ALL ENTRIESarray UPDATE... SET... WHEREstatement

ABAP Performance Tuning for SAP R/3 4 Database architecture

ABAP Performance Tuning for SAP R/3 5 Rules of Efficient Database Programming (I) 1. Keep the hit set small –specify everything you know in the WHERE clause 2. Keep data to be transferred small –projection views and field lists –no workarea update –aggregate functions and group by 3. Keep the number of transfers small –use array changes –avoid nested selects (possible alternatives: joins, subselects, explicit cursors) 4. Keep the area to be searched small –let the database use the indexes in an optimal way –create good indexes

ABAP Performance Tuning for SAP R/3 6 Rules of Efficient Database Programming (II) 5. Take load off the database where possible –Table buffering –Avoid repeated reading of data (e.g. use global reading module for master data) –Avoid SELECT before changes –Avoid restart logic for mass data processing Better use open cursor with hold –Use SORT instead of ORDER BY where possible –Use DELETE ADJACENT instead of DISTINCT where possible –Use logical databases only if design is appropriate –Avoid dynamic SQL because it is not using buffering mechanisms

ABAP Performance Tuning for SAP R/3 7 ABAP/4 Performance Tuning(Technique # 1) Bad statement  SELECT * FROM table Ex) SELECT * FROM VBAK ….. WRITE : / VBAK-VBELN, …….. ENDSELECT. Good statement  SELECT col1,col2 into(col1,col2) FROM table Ex) SELECT VBELN, AUART, BNAME, KUNNR INTO (VBAK-VBELN, VBAK-AUART,.) FROM VBAK ….. WRITE : / VBAK-VBELN, VBAK-AUART,. 결론 : 1000 레코드 선택시 SELECT * FROM table  2,910,000 ms(micro seconds) SELECT col1,col2..  239,000 ms DB SVR 와 AP SVR 간 데이터 전송 부하가 적고, 데이터 베이스의 I/O 횟수를 줄임. 필요한 컬럼을 선택하여 AP SVR 의 버퍼에 loading 함으로 전체 메모리 사용률을 줄일 수 있음

ABAP Performance Tuning for SAP R/3 8 ABAP/4 Performance Tuning(Technique # 2) Bad statement  SELECT FROM table... EXIT Ex) SELECT VBELN BNAME INTO (VBAK-VBELN,.) FROM VBAK. IF SY-DBCNT > EXIT. ENDIF. WRITE : / VBAK-VBELN, VBAK-BNAME,……. ENDSELECT. Good statement  SELECT col1,col2 into(col1,col2) FROM table UPTO n ROWS Ex) SELECT VBELN, AUART, BNAME, KUNNR INTO (VBAK-VBELN, VBAK- AUART,.) FROM VBAK ….. UPTO 1 ROWS. WRITE : / VBAK-VBELN, VBAK-AUART,. 결론 : 1000 레코드 선택시 SELECT... EXIT. ENDSELECT.  410,000 ms SELECT.. UPTO 1 ROWS  368,000 ms

ABAP Performance Tuning for SAP R/3 9 ABAP/4 Performance Tuning(Technique # 3) Bad statement  SELECT FROM table... CHECK Ex) SELECT VBELN … INTO ( VBAK-VBELN, ….) FROM VBAK. CHECK VBAK-VBELN+7(1) = ‘9’. WRITE : / VBAK-VBELN,…… ENDSELECT. Good statement  SELECT col1,col2 into(col1,col2) FROM table WHERE Clause Ex) SELECT VBELN, AUART, BNAME, KUNNR INTO (VBAK-VBELN, VBAK-AUART,.) FROM VBAK … WHERE VBAK-VBELN LIKE ‘ ‘. WRITE : / VBAK-VBELN, VBAK-AUART,. 결론 : 57,000 레코드 선택시 SELECT... CHECK.  27,958,000 ms SELECT …WHERE clause.  3,065,000 ms

ABAP Performance Tuning for SAP R/3 10 ABAP/4 Performance Tuning(Technique # 4) Bad statement  DBMS sort 사용 Ex) SELECT VBELN.. INTO (VBAK-VBELN,…..) FROM VBAK WHERE BNAME IN S_BNAME ORDER BY BNAME Good statement  AP 서버 internal table sort 사용 Ex) SELECT VBELN, AUART, BNAME, KUNNR INTO TABLE IVBAK FROM VBAK WHERE BNAME IN S_BNAME. SORT IVBAK BY BNAME.

ABAP Performance Tuning for SAP R/3 11 ABAP/4 Performance Tuning(Technique # 5) Bad statement  SELECT & APPEND Ex) SELECT VBELN …. INTO (IVBAK-VBELN,… ) FROM VBAK WHERE BNAME IN S_BNAME APPEND IVBAK ENDSELECT. Good statement  SELECT INTO TABLE Ex) SELECT VBELN, AUART, BNAME, KUNNR INTO TABLE IVBAK FROM VBAK WHERE BNAME IN S_BNAME.

ABAP Performance Tuning for SAP R/3 12 ABAP/4 Performance Tuning(Technique # 6) Bad statement  NESTED SELECTS Ex) SELECT VBELN AUART VTWEG VKORG SPART INTO IVBAK FROM VBAK WHERE VBELN BETWEEN..... AND SELECT POSNR MATNR ZMENG MEINS INTO IVBAP FROM VBAP WHERE VBELN = IVBAK-VBELN. WRITE : /IVBAK-VBELN, ENDSELECT. Good statement  데이터 베이스 VIEWS 사용 Ex) SELECT * FROM ZV_VBAK WHERE VBELN BETWEEN.... AND.... WRITE : ZV_VBAK-VBELN,..... ENDSELECT. 데이터 베이스 view 는 tables join, columns projection, rows selection 에 의한 logical table 임. Join 문장을 사용 할 수 있음 SAP R3 3.1 부터 ABAP SQL 에서 JOIN 가능함.

ABAP Performance Tuning for SAP R/3 13 ABAP/4 Performance Tuning(Technique # 7) Bad statement  ABAP CALCULATIONS(Collect) Ex) SELECT MATNR KWMENG MEINS INTO VBQTY FROM VBAPWHERE ….. COLLECT VBQTY. ENDSELECT. Good statement  DBMS SUM, AVG, MIN, MAX 기능 사용 Ex) SELECT MATNR SUM(KWMENG) MEINS INTO TABLE VBQTY FROM VBAP WHERE ….. GROUPBY ….. 합계, 평균, 최대값, 최소값 등 수를 계산할 때 DBMS 의 기능을 사용하는 것이 좋다. 최적의 logic 으 로 처리 하기 때문임.

ABAP Performance Tuning for SAP R/3 14 ABAP/4 Performance Tuning(Technique # 8) Bad statement  READ TABLE..WITH KEY. Ex) SELECT VBELN KUNNR.... INTO TABLE IVBAK WHERE READ TABLE IVBAK WITH KEY VBELN = ‘ ’. Good statement  READ TABLE..WITH KEY. BINARY SEARCH ( TRANSPORTING NO FIELDS) Ex) SELECT VBELN KUNNR.... INTO TABLE IVBAK WHERE … READ TABLE IVBAK WITH KEY VBELN = ‘ ’. BINARY SEARCH ( TRANSPORTING NO FIELDS) Large internal table 을 처리할 때 binary search transport no fields 를 사용 한다.

ABAP Performance Tuning for SAP R/3 15 ABAP/4 Performance Tuning(Technique # 9) Bad statement  LOOP AT ITAB1. MOVE ITAB1 TO ITAB2. APPEND ITAB2. ENDLOOP. Good statement  Itab2[ ] = itab1[ ]. 같은 구조 internal table 간 데이터 이동을 전제로 함.

ABAP Performance Tuning for SAP R/3 16 ABAP/4 Performance Tuning(Technique # 10) Bad statement  LOOP AT ITAB1. MOVE ITAB1 TO ITAB2. APPEND ITAB2. ENDLOOP. Good statement  APPEND LINES OF ITAB1 TO ITAB2. Internal table 내 data append 하기

ABAP Performance Tuning for SAP R/3 17 ABAP/4 Performance Tuning(Technique # 11) Bad statement  LOOP AT IVBAK WHERE BNAME = ‘SMITH’. DELETE BNAME. ENDLOOP. Good statement  DELETE IVBAK WHERE BNAME = ‘SMITH’. Internal table 내 data 삭제하기.

ABAP Performance Tuning for SAP R/3 18 ABAP/4 Performance Tuning(Technique # 12) Bad statement  select * from vbap where vblen = vbak-vblen. check vbap-pstyv = ‘ZRE3’. check vbap-werks = ‘0100’. Good statement  select * from vbap where vblen = vbak- vblen and pstyv= ‘ZRE3’ and werks=‘0100’. Transparent table 를 select 할 경우 가능한 모든 key field 를 where 절에 사용 하라. Bad statement 는 Application server 의 많은 memory 가 이용 된다.

ABAP Performance Tuning for SAP R/3 19 ABAP/4 Performance Tuning(Technique # 13) Bad statement  select * from bseg where bukrs= bsik-bukrs and rebzg=bsik-belnr and lifnr=bsik-lifnr and shkzg=‘S’ and koart=‘K’. Good statement  select * from bseg where bukrs=bsik-bukrs and rebzg=bsik-belnr. check lifnr=bsik-lifnr. check shkzg=‘S’. check koart=‘K’. Pool,cluster table 의 data 는 위의 statement 가 parse 되기 전 data 부분을 unpack 시켜야 만 한다. 따라서 해당 logical table 의 key field 만 where 절에 사용하고, 나머지는 check 문장에 사용한다.

ABAP Performance Tuning for SAP R/3 20 ABAP Performance Tuning( 기 타 ) Native SQL 활용 오라클 DB link 사용시 SQL join 문장 사용시 SELECT SINGLE 을 자주 사용 key 를 잘 만들자 (index) Index full scan 보다는 table full scan 이 오히려 좋다. R3 특성상 mandt field 로 인해 index full scan 을 초래함. Index 는 single block read 이고,table 은 multi block read 임. Select ~ option 중 client specified 에 의해 mandt field 를 ABAP 문장에서 사용 가능함. Read only table 은 buffering 을 활용하라. Full buffering( 작은 table),Generic buffering( 큰 table) 을 사용할 수 있다. SQL Trace 와 ABAP trace 를 적절히 사용하라. Index 사용여부,full scan,DB 및 AP 서버 사용 비율 등을 점검하여 튜닝 POINT 확인