33
Best Practices for Creating and Optimizing Aggregates in SAP BW Gary Nolan SAP

Best Practices for Creating and Optimizing Aggregates in SAP BW

  • Upload
    jaguar

  • View
    52

  • Download
    2

Embed Size (px)

DESCRIPTION

aggregates

Citation preview

Page 1: Best Practices for Creating and Optimizing Aggregates in SAP BW

Best Practices for Creating and Optimizing Aggregates in SAP BW

Gary NolanSAP

Page 2: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 2

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 3: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 3

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 4: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 4

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 transparentdatabase 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

Page 5: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 5

Aggregates: Concept

Flow with aggregate

Data transfer from InfoCube to query (revenue grouped by month)

Flow without aggregate

InfoCube Records read on the database Records

transferred to SAP BW

instance after being

summarized on the database

Aggregate

Month Material RevenueJuly Hammer 10July Nail 20August Hammer 10August Nail 20

Month RevenueJuly 30August 30

Month Material RevenueJuly Hammer 10July Nail 20August Hammer 10August Nail 20

Month RevenueJuly 30August 30

Page 6: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 6

Aggregates: Overview

Aggregates can be created onDimension characteristicsNavigational attributesHierarchy levelsTime-dependent hierarchies and attributes (as of 30A)

Aggregates cannot be created on Multicubes, RemoteCubes, or ODS

Aggregates can be created for* – All characteristics valuesF – Fixed characterisic valuesH – Hierarchy nodes

Aggregates are useful for key figure values withSummationMaximumMinimumNOT AVG

Page 7: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 7

Grouped By Characteristic: Technical View

Fact Table: Sales DataFact Table: Sales Data Aggregate Tables: Sales DataAggregate Tables: Sales Data

Country *Country *

/BI0/F<CUBENAME>

/BI0/E<CUBENAME>

/BI0/F<CUBENAME>

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

/BI0/E<1XXXXX>

/BI0/F<1XXXXX>

/BI0/E<1XXXXX>

Country

Customer

/BI0/D<CUBENAME>1

/BI0/D<CUBENAME>2

Shared dimension

table

Fact table

Dimensions

Characteristics

Page 8: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 8

Aggregates: Goal

Query performance Improvement

Cost of aggregate

The goal of aggregates is to balance

Page 9: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 9

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 10: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 10

Change Run/Apply Job

There are two steps in the change run:

Activate the new master data and hierarchy dataMaster 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 hierarchyPercentage parameter in the IMG determines if the aggregate is fixed or dropped and rebuilt completelyChange 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 runABAP Program RSDDS_CHANGERUN_MONITOR can be used to monitor change run in progress

Page 11: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 11

Aggregate Rollup

Applies newly loaded transactional data to the aggregateThe 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 reportingCan 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 20BAfter release 30A you can choose not to compress

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

Rollup is not possible if change run is running

Page 12: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 12

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 13: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 13

Creation of Aggregates

Page 14: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 14

Additional InfoObjects Added Automatically

Time dimensionIf 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

While you add InfoObjects to an aggregate, additional InfoObjects may be added automatically by the system in the following cases:

Page 15: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 15

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 InfoCubeAggregate must be deactivated first

InfoCube can be set to allow for uncompressed aggregatesAllows for the backing out of packages without deactivation of aggregatesAggregate 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

Page 16: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 16

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 17: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 17

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 aggregate’s 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

Page 18: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 18

How to Determine a Suitable Aggregate …

Page 19: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 19

Turning on SAP BW Statistics

Page 20: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 20

SAP BW StatisticsMultiCube

Queriesor ODBOQueries

or ODBO

AggregatesAggregates

WarehouseManagementWarehouse

Management

Table RSDDSTAT

Analysis by queries

(in workbooks)

Table RSDDSTATAGGR

Table RSDDSTATWHM

Info-SourceInfo-

Source

Turn on/off logging for each InfoCube

Updaterules

Updaterules

SAP BW Statistics

Info-SourceInfo-

Source

Info-SourceInfo-

SourceUpdaterules

Updaterules

Updaterules

Updaterules

Page 21: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 21

Good Aggregate Candidate

PoorAggregate Candidate

Look for aggregates with …•Low mean overall time•High navigations•High percentage db time in relation to overall time

Using SAP BW Statistics to Find Potential Aggregates

Page 22: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 22

Is My Aggregate Being Used?

SAP BW Statistics Cubes

Transaction RSRT

RSRTRACE

Page 23: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 23

Aggregates not affected by change run

Aggregates not affected by change run

7,000,000records InfoCube

Basis Aggregate

Aggregate 1 Aggregate 2 Aggregate 3

400,000records

100,000records

110,000records

30,000records

Region Country Salesman Product Customer Day Month Year

Customer Salesman Product DayMonth Year

Customer__Industry Day Month Year

Product__Category Day Month Year

Salesman_CountryDay Month Year

Basis Aggregates

Page 24: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 24

Bad Aggregates

Very large aggregatesCompare aggregate fact table size with the InfoCube fact table

No more than 20% of fact table is a good rule of thumbSummarization level should be approx. 10 records summarized

Not a rule – just a guideline

Redundant aggregates

Unused or seldom-used aggregates

Dynamic navigational attributes

Page 25: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 25

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 26: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 26

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

Page 27: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 27

Other Factors Affecting Performance

Data ModelDimensions/Fact Table

Line-item DimensionsUse of Multi-ProvidersException Aggregation (MIN/MAX, AVG, LAST, FIRST)Time-Dependent Attributes/Hierarchies

Query Read Mode – Table RSRREPDIR

InfoCube Compression/PartitioningAggregate Compression

Query DesignVirtual Characteristics/Key FiguresCalculation before aggregationFilter CriteriaInitial View – should use aggregate

Database Statistics

Page 28: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 28

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 developersFocus around SAP NetWeaver and SAP xApps

High quality of technical resourcesArticles, 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 PortalFeaturing collaboration capabilities of SAP Knowledge Management

Page 29: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 29

What We’ll Cover …

Aggregates – Overview

Change Run

Aggregate Creation

Time-Dependent Aggregates

Aggregates and Performance

Wrap-up

Page 30: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 30

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 aggregatesChange RunRollup 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

Page 31: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 31

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

Page 32: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 32

Q&A

Questions?

Gary NolanPlatinum Consultant, SAP America Inc.

[email protected]

Page 33: Best Practices for Creating and Optimizing Aggregates in SAP BW

© SAP AG 2005, 33

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 astheir 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.

Copyright 2005 SAP AG. All Rights Reserved