Vous êtes sur la page 1sur 33

Best Practices for Creating and Optimizing Aggregates in SAP BW

Gary Nolan
SAP

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 2

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 3

Aggregate: Definition Aggregates are subsets of fact table data where summary data is stored as part of new, transparent InfoCubes
Aggregates have the same structure as an InfoCube, with transparent database tables and fact tables surrounded by dimension tables Aggregates are: Used to substantially improve the performance of queries Totally transparent to the users Able to have summarization done during load, not during runtime Used to reduce the volume of data read while querying

SAP AG 2005, 4

Aggregates: Concept
Data transfer from InfoCube to query (revenue grouped by month)
Flow without aggregate

Month July July August August

Material Revenue Hammer 10 Nail 20 Hammer 10 Nail 20

Month July July August August

Material Revenue Hammer 10 Nail 20 Hammer 10 Nail 20

InfoCube

Records read on the database


Month Revenue July 30 August 30

Month Revenue July 30 August 30

Aggregate Flow with aggregate

Records transferred to SAP BW instance after being summarized on the database

SAP AG 2005, 5

Aggregates: Overview
Aggregates can be created on
Dimension characteristics Navigational attributes Hierarchy levels Time-dependent hierarchies and attributes (as of 30A)

Aggregates cannot be created on Multicubes, RemoteCubes, or ODS Aggregates can be created for
* All characteristics values F Fixed characterisic values H Hierarchy nodes

Aggregates are useful for key figure values with


Summation Maximum Minimum NOT AVG

SAP AG 2005, 6

Grouped By Characteristic: Technical View


Customer

/BI0/D<CUBENAME>1

Fact FactTable: Table:Sales SalesData Data

Aggregate AggregateTables: Tables:Sales SalesData Data Country Country **


/BI0/F<1XXXXX> /BI0/F<1XXXXX> /BI0/E<1XXXXX> /BI0/E<1XXXXX>

/BI0/F<CUBENAME> /BI0/F<CUBENAME> /BI0/E<CUBENAME> /BI0/E<CUBENAME>

/BI0/D<CUBENAME>2

Shared dimension table

Fact table Dimensions Country Characteristics

SAP AG 2005, 7

Aggregates: Goal

The goal of aggregates is to balance

Cost of aggregate

Query performance Improvement

SAP AG 2005, 8

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 9

Change Run/Apply Job


There are two steps in the change run: Activate the new master data and hierarchy data
Master data is only available after the change run has completed successfully

All aggregates containing navigational attributes and/or hierarchies are realigned and recalculated with the new master data
Affects all aggregates that contain the changed attribute and/or hierarchy Percentage parameter in the IMG determines if the aggregate is fixed or dropped and rebuilt completely Change run can be started for specific InfoObjects Key figures that are set for exception aggregation MIN and MAX cause the aggregates to be completely rebuilt for each change run ABAP Program RSDDS_CHANGERUN_MONITOR can be used to monitor change run in progress

SAP AG 2005, 10

Aggregate Rollup
Applies newly loaded transactional data to the aggregate
The packet is not available for reporting until the aggregate rollup is complete
Prevents user from running reports and getting some data that is in an aggregate and other data that is not in an aggregate

During aggregate rollup the previously rolled up data is available for reporting Can be set to automatic or run as a separate job
Should be set to a separate job if multiple data packets are to be loaded

Aggregates are then compressed


Automatically occurs in version 21C and 20B After release 30A you can choose not to compress

Backing out of data packets


Version 2.1C and 2.0B requires dropping of the aggregates Version 3.0B+ you can back out individual packets without dropping aggregates (uncompressed aggregates)

Rollup is not possible if change run is running

SAP AG 2005, 11

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 12

Creation of Aggregates

SAP AG 2005, 13

Additional InfoObjects Added Automatically

While you add InfoObjects to an aggregate, additional InfoObjects may be added automatically by the system in the following cases: Time dimension
If you add an InfoObject (such as 0CALMONTH), all InfoObjects that can be derived from this InfoObject are added automatically (for example, 0CALQUARTER, 0CALYEAR)

Compound objects

SAP AG 2005, 14

Uncompressed Aggregates
Compression refers to the consolidation of data in an aggregate and the elimination of the data packet ID from the data Aggregates are compressed by default
This allows for smaller, more efficient aggregates

Data cannot easily be backed out from the InfoCube


Aggregate must be deactivated first

InfoCube can be set to allow for uncompressed aggregates


Allows for the backing out of packages without deactivation of aggregates Aggregate size is larger because no consolidation of data across the data packets Set in the Manage tab of the InfoCube (right-click on InfoCube and choose Manage Rollup Tab) BOTTOM LINE: Aggregates should only be set to uncompressed if routine backing out of data packages is expected

SAP AG 2005, 15

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 16

Time-Dependent Aggregates
With BW 3.x, you can establish aggregates for time-dependent master data To use the time-dependent aggregates, a key date is set in the time-dependent aggregate
Data is aggregated by key date. If a query is run outside key date, aggregate is not used

Variables can be set on key date to allow for a dynamic setting in the aggregate System automatically adjusts the aggregates key date and values when the adjustment of time-dependent aggregates job is run
This can be set to run in batch via process chains

SAP AG 2005, 17

How to Determine a Suitable Aggregate

SAP AG 2005, 18

Turning on SAP BW Statistics

SAP AG 2005, 19

SAP BW Statistics

Turn on/off logging for each InfoCube

Table RSDDSTAT

Queries Queries or or ODBO ODBO

InfoInfoSource Source InfoInfoSource Source InfoInfoSource Source

Update Update rules rules

Aggregates Aggregates
Table RSDDSTATAGGR

Update Update rules rules Update Update rules rules

Warehouse Warehouse Management Management

SAP BW Statistics MultiCube Analysis by queries (in workbooks)

Table RSDDSTATWHM

SAP AG 2005, 20

Using SAP BW Statistics to Find Potential Aggregates

Poor Aggregate Candidate Good Aggregate Candidate

Look for aggregates with Low mean overall time High navigations High percentage db time in relation to overall time
SAP AG 2005, 21

Is My Aggregate Being Used?


SAP BW Statistics Cubes Transaction RSRT RSRTRACE

SAP AG 2005, 22

Basis Aggregates Aggregates Aggregates not not affected affected by by change change run run
400,000 records 7,000,000 records Region Country Salesman Product Customer Day Month Year Customer Salesman Product Day Month Year

InfoCube

Basis Aggregate

100,000 records
Aggregate 1

110,000 records
Aggregate 2

30,000 records
Aggregate 3

Customer__Industry Day Month Year


SAP AG 2005, 23

Product__Category Day Month Year

Salesman_Country Day Month Year

Bad Aggregates
Very large aggregates
Compare aggregate fact table size with the InfoCube fact table
No more than 20% of fact table is a good rule of thumb

Summarization level should be approx. 10 records summarized


Not a rule just a guideline

Redundant aggregates Unused or seldom-used aggregates Dynamic navigational attributes

SAP AG 2005, 24

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 25

Monitoring and Performance Tuning Cycle

Performance tuning is an ongoing task As business changes occur, new queries are developed potentially requiring new aggregates Volume of data increases, so performance issues could surface

SAP AG 2005, 26

Other Factors Affecting Performance


Data Model
Dimensions/Fact Table
Line-item Dimensions

Use of Multi-Providers Exception Aggregation (MIN/MAX, AVG, LAST, FIRST) Time-Dependent Attributes/Hierarchies

Query Read Mode Table RSRREPDIR InfoCube Compression/Partitioning


Aggregate Compression

Query Design
Virtual Characteristics/Key Figures Calculation before aggregation Filter Criteria Initial View should use aggregate

Database Statistics

SAP AG 2005, 27

For More Information: Access the SAP Developer Network www.sdn.sap.com


The central hub for the SAP technology community
Everyone can connect, contribute, and collaborate consultants, administrators, and developers Focus around SAP NetWeaver and SAP xApps

High quality of technical resources


Articles, how-to guides, Weblogs, collaborative areas, discussion forums, downloads, toolkits, and code-samples

A collaboration platform, not a one-way street


SAP experts from customers, partners and SAP

SDN is powered by SAP NetWeaver


Built on the SAP Enterprise Portal Featuring collaboration capabilities of SAP Knowledge Management

SAP AG 2005, 28

What Well Cover


Aggregates Overview Change Run Aggregate Creation Time-Dependent Aggregates Aggregates and Performance Wrap-up

SAP AG 2005, 29

7 Key Points to Take Home


Aggregates aid in query performance Aggregates are nothing more than MiniCubes with a subset of data from a larger InfoCube There is a price to pay for setting up aggregates
Change Run Rollup Job

Statistics should be used to determine suitable aggregates Aggregates can be created on time-dependent master data Aggregates can be set to be compressed or uncompressed Aggregates should be continually monitored to determine if they are still being used

SAP AG 2005, 30

Helpful OSS Notes


Note 166433 Options for Finding Aggregates Note 202469 Tracing Queries with Aggregates Note 176606 Aggregate Change Run Note 388069 Change Run Monitor Note 484536 Filling Aggregates of Large InfoCubes Note 388069 Monitor the Change Run Note 125681 Exception Aggregation Note 189150 Non-Cum. Key Figures before Aggregation Note 99010 Using RSRTRACE

SAP AG 2005, 31

Questions?

Q&A
Gary Nolan Platinum Consultant, SAP America Inc. gary.nolan@sap.com
SAP AG 2005, 32

Copyright 2005 SAP AG. All Rights Reserved


No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint and SQL Server are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix and Informix Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries. ORACLE is a registered trademark of ORACLE Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, the Citrix logo, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, MultiWin and other Citrix product names referenced herein are trademarks of Citrix Systems, Inc. HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. JAVA is a registered trademark of Sun Microsystems, Inc. JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MarketSet and Enterprise Buyer are jointly owned trademarks of SAP AG and Commerce One. SAP, R/3, mySAP, mySAP.com, xApps, xApp and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies.

SAP AG 2005, 33

Vous aimerez peut-être aussi