© 2011 SAP AG. All rights reserved. 1
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
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. 3
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
General Modeling Principles
Column Store Analytical Views Attribute Views Calculation Views Client / Application A B C D A B C D G Y A G Y A G Y ZFilter data amount as early as possible in the lower layers (CONSTRAINTS, WHERE Clause, Aggregate data records (e.g using GROUP BY, reducing Coulmns)
Avoid transfer data of large resultsets between the HANA DB and client application
- Do calculation after aggregation.
- Avoid Complex expressions (IF, CASE, ... )
Join on Key Columns or Indexed Columns
Avoid calculations before aggregation on line item level Reduce data transfer between views
© 2011 SAP AG. All rights reserved. 5
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
Modeling Example 1
Restricted Measures vs Logical Partitioning
Analytical View
• Define 3 Restricted Measures - once for each PLANT (A,B & C) within a single Analytical View
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
© 2011 SAP AG. All rights reserved. 7
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
Modeling Example 2
Calculated Attributes - Row vs Sets
Calculation View
• Re-use the same Analytical View 3x
• Define a Current Year Key filter in each Projection Node • Combine results using Union Constants
Analytical View
• Define 4 Calculated Attributes
Filter [3] 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 [2]
Current Year Filter
Current Year [midstr(now(),1,4)]
Previous Year [ (“current_year")-1] Earliest Year [(“previous_year")-1]
© 2011 SAP AG. All rights reserved. 9
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
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. 11
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
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)
SQL
CE Functions
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.
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. 13
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
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
• 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
© 2011 SAP AG. All rights reserved. 15
Join Types - Example
Customer
( … Right table / Header / Dimension for sales) ( … Central / Left / Many table for state
Sales
( … Fact table / Central / Left / Items / Many)
C_ID ORDER_ID AMOUNT
1 1 100
1 2 100
2 3 100
4 4 100
77 8 100
C_ID CNAME STATE AGE
1 WERNER MI 10 2 MARK MI 11 3 TOM TX 12 4 BOB TX 13 STATE SNAME MI MICHIGAN AL ALABAMA
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
Join Types – Referential Join in Attribute Views
C_ID CNAME STATE AGE SNAME
1 WERNER MI 10 MICHIGAN
2 MARK MI 11 MICHIGAN
SELECT
C_ID, CNAME, STATE, AGE, SNAME
C_ID CNAME AGE
1 WERNER 10
2 MARK 11
SELECT
C_ID, CNAME, AGE
*** 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. 17
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.
*** Since there are no dimensions joined to C_ID all the facts will be returned.
C_ID AMOUNT
1 200 2 100 4 100 77 100
Join Types – Text Join for multilingual reporting
Text Join is used whentranslation 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. 19
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
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
© 2011 SAP AG. All rights reserved. 21
SBO Explorer – Recommendation #1
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. 23
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).
SBO Explorer – Recommendation #3
© 2011 SAP AG. All rights reserved. 25
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
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. 27
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
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. 29
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
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. 31
Drill functionality in SBO WebIntelligence
Start Drilling and navigate along hierarchies…
Down Up
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
© 2011 SAP AG. All rights reserved. 33
Thank You!
Patrice Le Bihan – [email protected] Werner Steyn – [email protected]
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.
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.
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.