Best Practices for Optimal Data Models in SAP HANA and Analytics in SAP BusinessObjects 4.0 - Webinar Presentation...
SAP HANA 1.0
Best Practices for optimal data models in SAP HANA and analytics in SAP BusinessObjects 4.0 Patrice Le Bihan Werner Steyn Customer Solution Adoption (CSA) January 2012
© 2011 SAP AG. All rights reserved.
1
Disclaimer
This presentation outlines our general product direction and should not be relied on in making a purchase decision. This presentation is not subject to your license agreement or any other agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or to develop or release any functionality mentioned in this presentation. This presentation and SAP's strategy and possible future developments are subject to change and may be changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP assumes no responsibility for errors or omissions in this document, except if such damages were caused by SAP intentionally or grossly negligent.
© 2011 SAP AG. All rights reserved.
2
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
3
General Modeling Principles Avoid transfer data of large resultsets between the HANA DB and client application
Client / Application A
G
Y
- Do calculation after aggregation.
Z
- Avoid Complex expressions (IF, CASE, ... )
Calculation Views
Attribute Views
Analytical Views
Reduce data transfer between views A
G
Y
A
B
C
Aggregate data records (e.g using GROUP BY, reducing Coulmns)
D
G
Y
Join on Key Columns or Indexed Columns Avoid calculations before aggregation on line item level
A
Column Store
© 2011 SAP AG. All rights reserved.
B
C
D
Filter data amount as early as possible in the lower layers (CONSTRAINTS, WHERE Clause, Analytical Privileges..)
4
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
5
Modeling Example 1 Restricted Measures vs Logical Partitioning Multiple Analytical Views + 1 Calculation View • Create 3 Analytical views – one for each PLANT • Define a design time filter (PLANT) on each Analytical View • Create a Calculation view that reads each Analytical view • Combine the results using Union Constants
Analytical View • Define 3 Restricted Measures - once for each PLANT (A,B & C) within a single Analytical View
© 2011 SAP AG. All rights reserved.
PLANT A View
PLANT B View
PLANT C View
100
200
300
6
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
7
Modeling Example 2 Calculated Attributes - Row vs Sets Analytical View • Define 4 Calculated Attributes Current Year [midstr(now(),1,4)] Previous Year [ (“current_year")-1] Earliest Year [(“previous_year")-1] Current Key [if(“cur"=“year",1,if(“prev"=“year",2,if(“earl"=“year",3),-1)]
Calculation View
Current Year Filter
• Re-use the same Analytical View 3x • Define a Current Year Key filter in each Projection Node • Combine results using Union Constants
Filter [2]
Analytical View + 1 Calculation View • Create a Analytical View without any Calculated Attributes, instead define Calculated Columns in a Calculation View • Create a Calc. View reading from a single Analytical View • Add one Projection Node above the Analytical View & add Calculated Columns • Stack 3 Projection nodes and Filter by Current Year Key • Combine results using Union Constants Filter [1]
Filter [1] Filter [3] Filter [3]
Filter [2]
© 2011 SAP AG. All rights reserved.
8
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
9
Modeling Example 3 Calculate Before Aggregation
Analytical View • Define Calculated Measure threshold (i.e. NETWR > 99) using the Expression Editor • Check Calculate Before Aggregation • The result will either be 1 or 0 per row • Use regular SUM aggregation to calculate count based on threshold calculation
Use with caution, row based processing significantly slower than set based processing
© 2011 SAP AG. All rights reserved.
10
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
11
Modeling Example 4 Calculation View – SQL vs CE Functions Calculation Engine (CE) Functions • Preferred over SQL • Improved performance, can be optimized by the engine (i.e. field pruning & parallelized) Even though only MATNR & NETWR are requested by the front end tool all fields will be retrieved from the table including all calculations will be done irrespective. SQL
CE Functions Only MATNR & NETWR will be retrieved from the database. Only NETWR will be calculated. Columns requested by the front end tool can be parallelized
© 2011 SAP AG. All rights reserved.
12
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
13
Join Types – Definitions and Referential Integrity Join Type
Use when you need to report on…
Be aware that…
INNER
facts with matching dimensions only
facts without any dimension will be excluded dimensions without any fact will be excluded JOIN is always performed
LEFT OUTER
all posted facts whether there is a matching dimension or not
dimensions without any fact will be excluded best for performance because JOIN is omissible
RIGHT OUTER
all dimensions whether there are matching facts or not
facts without any dimension will be excluded JOIN is always performed
REFERENTIAL
facts for the requested dimensions AND referential integrity is ensured
• • •
TEXT
an SAP dimension table joined to a text table for translation purpose
only available for Attribute Views with SAP ERP tables (SPRAS field) or equivalent design acts as an INNER
© 2011 SAP AG. All rights reserved.
it is the default join type acts as an INNER for Attributes Views join on attribute views is “optional”, which facts are returned will depend on which attributes are queried for
14
Join Types - Example Sales
Customer
( … Fact table / Central / Left / Items / Many)
( … Right table / Header / Dimension for sales) ( … Central / Left / Many table for state
C_ID
ORDER_ID AMOUNT
C_ID CNAME
STATE
AGE
1
1
100
1
WERNER
MI
10
1
2
100
2
MARK
MI
11
2
3
100
3
TOM
TX
12
4
4
100
4
BOB
TX
13
77
8
100
State ( … Right table / Header / Dimension for customer) Notes: Order 8 does not have a customer master record Customer TOM does not have any orders State TX does not have a description No customers reside in Alabama
© 2011 SAP AG. All rights reserved.
STATE SNAME MI
MICHIGAN
AL
ALABAMA
15
Join Types – Referential Join in Attribute Views SELECT C_ID, CNAME, STATE, AGE, SNAME
C_ID
CNAME
STATE AGE
SNAME
1
WERNER
MI
10
MICHIGAN
2
MARK
MI
11
MICHIGAN
SELECT C_ID, CNAME, AGE
C_ID
CNAME
AGE
1
WERNER
10
2
MARK
11
*** Referential join is a feature available only in OLAP engine, when testing Attribute views outside the context of a Analytical view then the Join Engine will perform a Inner Join. As a result TOM and BOM will not be returned.
© 2011 SAP AG. All rights reserved.
16
Join Types – Referential Join in Analytic Views Customer
Sales
2 table referential join in Data Foundation. No dimensions.
*** Customer table join will be omitted since only fields are selected from the left table
*** Since the field AGE is selected from the right table then a inner join is preformed resulting in order 8 not being returned.
© 2011 SAP AG. All rights reserved.
C_ID
AMOUNT
1
200
2
100
4
100
77
100
*** Since there are no dimensions joined to C_ID all the facts will be returned.
17
Join Types – Text Join for multilingual reporting
Text Join is used when translation for a dimension is available
Designed for ERP table (and typically SPRAS field)
Act as an INNER join User language is used as a filter at runtime to find the right translation for that attribute
© 2011 SAP AG. All rights reserved.
18
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
19
Do’s and Don’ts with SBO Explorer
Recommendation
Description
1
Only include dimensions (facets) the end user absolutely needs, 6-10 facets seem to work for most cases
2
If the end user needs more facets but response time is the priority, split the Information Space in two spaces. Restrict each Information Space to one or two hierarchies (navigation paths)
3
The first measure on the list should be one that leads to the easiest / lightest calculation (among all available measures)
4a
Use the "Show facets in the defined order" option when the facet order matters to end users and select a “fast” dimension first
4b
Use the "Order facets by filtering capability“ option if the facet order is not so important, Explorer will determine the optimal order
© 2011 SAP AG. All rights reserved.
20
SBO Explorer – Recommendation #1 Avoid selecting all dimensions available from the HANA view
© 2011 SAP AG. All rights reserved.
21
SBO Explorer – Recommendation #1 Only include dimensions (facets) the end user absolutely needs 6-10 facets seem to work for most cases
© 2011 SAP AG. All rights reserved.
22
SBO Explorer – Recommendation #2 If the end user needs more facets but response time is the priority, split the Information Space in two spaces. Restrict each Information Space to one or two hierarchies (navigation / drill paths). Suggestion: present Information Spaces side by side if the user needs more hierarchies at once
© 2011 SAP AG. All rights reserved.
23
SBO Explorer – Recommendation #3
The first measure on the list should be the easiest / lightest calculation
© 2011 SAP AG. All rights reserved.
24
SBO Explorer – Recommendation #4a Use the "Show facets in the defined order" option when the facet order matters to end users and select a “fast” dimension first
© 2011 SAP AG. All rights reserved.
25
SBO Explorer – Recommendation #4b use the "Order facets by filtering capability“ option if the facet order is not so important, Explorer will determine the optimal order
© 2011 SAP AG. All rights reserved.
26
Agenda
General Modeling Principles Restricted Measures vs Logical Partitioning Calculated Attributes - Row vs Sets Calculation Before Aggregation Calculation Views - SQL vs Calculation Engine Functions
Join Types and Referential Integrity Do’s and Don’ts with SBO Explorer Importance of Drill Functionality in SBO WebIntelligence
© 2011 SAP AG. All rights reserved.
27
Drill functionality in SBO WebIntelligence
Navigate along a hierarchy defined as a navigation path in a universe Only fetch data you need as you select a member and drill one level down Query data on demand as opposed to everything upfront Leads to (much) lighter reports, faster response times and better user experience
© 2011 SAP AG. All rights reserved.
28
Drill functionality in SBO WebIntelligence Navigate along a hierarchy defined as a navigation path in a universe Only fetch data you need as you select a member and drill one level down
HANA
© 2011 SAP AG. All rights reserved.
Universe (relational)
29
Drill functionality in SBO WebIntelligence
WebIntelligence
Query only the top level of the hierarchy
As opposed to all levels upfront
© 2011 SAP AG. All rights reserved.
30
Drill functionality in SBO WebIntelligence Start Drilling and navigate along hierarchies…
Down
Up
Alongside
© 2011 SAP AG. All rights reserved.
31
More Info http://help.sap.com/hana Previous Know How Webinars on SAP HANA : http://www.sdn.sap.com/irj/scn/khnc Building Advanced Data Models with SAP HANA: http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/208df7db-74bd-2e10-adac-b47ea848e5af
How to best leverage SAP BusinessObjects BI 4.0 on SAP HANA 1.0: http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/201d220d-11cc-2e10-39bf-e6cf6d42438b
Lessons Learned from the Provimi HANA Project: http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/30f565bb-2703-2f10-bab9-845b7a71da88
Upcoming white paper on SDN (January 2012) : “Creating a universe on SAP HANA: Best Practices”
© 2011 SAP AG. All rights reserved.
32
Thank You!
Patrice Le Bihan –
[email protected] Werner Steyn –
[email protected] SAP Customer Solution Adoption
© 2011 SAP AG. All rights reserved.
33
© 2011 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, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, 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 other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase, Inc. Sybase is an SAP company. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
© 2011 SAP AG. All rights reserved.
34