DBI331. Cube Measure Group Measure Partition Cube Dimension Dimension Attribute Relationship...

38
Microsoft SQL Server Analysis Services Design Challenges Peter Myers Mentor SolidQ DBI331

Transcript of DBI331. Cube Measure Group Measure Partition Cube Dimension Dimension Attribute Relationship...

Microsoft SQL Server Analysis Services Design Challenges

Peter MyersMentorSolidQ

DBI331

Presenter Introduction

Peter MyersMentor, SolidQBBus, MCITP (Dev, DBA, BI), MCT, MVP14 years of experience designing and developing software solutions using Microsoft products, today specializing in Microsoft Business IntelligenceBased in San [email protected]

Agenda

Reviewing UDM FundamentalsAddressing Design Challenges with:

Source Schema DesignData Source ViewsDimensionsCubesCube CalculationsCube EnhancementsSecurity

Demonstrations

Session Objectives

“It covers best practice design for dimensions and cubes, and also addresses common design challenges in relation to the supporting source schema design, cube calculations and security.”Arguably best practice “just depends” and so is open to healthy debate

Be prepared to assess your particular challenge and hypothesize, test, accept and reject a practice accordinglySome best practices can be demoted to “tips”

Session ObjectivesContinued

This session is about:Good modeling techniques with aim to produce a feature-rich and optimized UDMAdding business logic with MDXSecuring the UDM

This session does not directly cover the storage layer, including partitions, storage modes, aggregation design or processing

See session DBI407: Best Practices for Building Tier 1 Enterprise Business Intelligence Solutions with Microsoft SQL Server Analysis Services, presented by Adam Jorgensen

Words about AdventureWorks

Fictitious company upon which the AdventureWorks sample databases and tutorials are basedThese samples are good

Good for learning about designing and Analysis Services UDMGreat in fact, for supporting tutorials, labs and demonstrations

These samples are also badBad for learning best practice designWorse in fact, for using as a template for your UDMs

Reviewing the UDM Fundamentals

Cube

Measure Group

Measure

Partition

Cube Dimension

Dimension

Attribute Relationship

Hierarchy

Level

Cube Attribute

Cube Hierarchy

Measure Group

Dimension

MDX Script

Attribute

Source Schema Design

Dimensional modeling techniques have evolved to become largely best practice – learn from the mastersOngoing challenges:

Materializing calculations in fact tablesSnowflaking a dimension“Cleaning up” with junk dimension tablesModeling self-referencing relationships (AKA parent-child)

Sometimes there is a need to stop thinking relationally, and to start think multidimensionally

Be prepared to be creativeBe prepared to think outside the square (and inside the cube)

Data Source View

Limit the Data Source View (DSV) to a single data sourcePre-integrate multiple data sources into a single “data mart”We recommend Integration Services

Base DSV tables on database objectsViewsTable-valued UDFs

Parameterized UDFs are a convenient and consistent way to configure partition queries

Data Source ViewContinued

If building a UDM on an OLTP schema, create views to imitate a true star schema

Preferably use an ETL process to materialize data in a true star schemaHowever, this approach is great for prototypes, and with good planning and care, you can retrofit a true star schema later

Define appropriate single-column keysDefine appropriate labels for member namesConsider pre-calculating, or partially calculating, values in the DSVName tables and columns in friendly terms

Dimensions

Optimized dimensions are a prerequisite for an optimized cubeThe most important three topics for optimizing dimensions:1. Attribute relationships2. Attribute relationships3. Attribute relationshipsSource: Ashvini Sharma

DimensionsAttribute Relationships

Only define relationships where they do existThis will be the case for natural hierarchies

DimensionsAttribute Relationships – Continued

There is a world of difference between this:

And:

DimensionsAttribute Relationships – Continued

Do not define relationships for unnatural hierarchies

So these relationships are perfectly fine left as is

DimensionsAttribute Relationships – Continued

The RelationshipType property comes in two flavors:Flexible (default)Rigid

It should be changed to Rigid when it is understood that related values will never change

(No need to consider if you do a full database process each time)Usually no problem if all changes are Type IICan be a serious problem otherwise as it will require a full dimension process to rectifyThe benefit of defining Rigid relationships is that incremental processing may not invalidate existing aggregationsHowever, watch for data entry fixes!

DimensionsAttribute Relationships – Continued

Attribute relationships have the following benefits:Reduce the cube space to what is possibleImprove processing performance

Fewer relationships between attribute memberships need to be created

Improve query performanceHierarchies are materializedThe query engine has hints as to how the members will be browsedAggregations can be created around the relationships

Allow defining member propertiesAllow sorting members by a related attribute’s key or nameEnsure security is enforced as you would expect

Users can only see the cities of the states they are allowed to see

DimensionsOther Challenges

Disabling hierarchiesAKA setting the AttributeHierarchyEnabled to FalseBe sure to set this for attributes that are not require for browsing; the values will become available via the member properties

Removing the All levelAKA setting IsAggretable to FalseUnderstand the repercussions and consider setting an appropriate default member

Defining defaultsThese may not be intuitive to users and could create confusion and result in the misinterpretation of query results

DimensionsOther Challenges – Continued

Despite the Best Practice Alerts (BPA) guidance, don’t get too carried away with hiding attributes

AKA setting the AttributeHierarchyVisible to FalseHidden hierarchies can be annoying for report authors trying to build filters based on an attribute hierarchy, rather than a multi-level hierarchyBe courageous enough to challenge the BPA’s “wisdom”

DimensionsOther Challenges – Continued

Despite the Dimension Wizard’s best intentions, when creating snowflake dimensions:

Set the UnknownMember property to None, andSet the attribute KeyColumns’ Source NullProcessing property to AutomaticThis way you will learn about integrity problems in your data and you can fix it there, or at least address it using logic in viewsConsidering using the UnknownMember feature when building a UDM on a data source with known issues, perhaps an OLTP database

Cubes

Including many subject areas (measure groups) in a single can be challenging to develop, maintain and use

Consider more databasesConsider smaller, subject specific, cubesPerspectives are an approach to making resource-rich cubes easier to understand and use

Optimize DistinctCount measures by placing them in their own measure group, and consider partitioning the measure group by the same column the measure is based onFormat measures appropriately

CubesContinued

Understand the “Enterprise” aggregation functions and when to use them

None, ByAccount, AverageOfChildren, FirstChild, FirstNonEmpty, LastChild, LastNonEmptyAppreciate some of these are computed at query time

Consider carefully the need to use non-regular measure group dimension relationships

Referenced, Fact, Many-to-ManyUnderstand the price to pay for using the different relationship typesUnderstand how to optimize Many-to-Many relationships

Cube Calculations

Understand the model requirements and define calculations and scoped assignments appropriatelyDesign the dimensions and cubes to support the required calculationsConsider pre-calculating, or partially calculating, values in the source database or DSVLimit nested calculationsConsider “offloading” complex calculations to UDFs

Cube CalculationsContinued

Know your MDX and the capabilities of the cube’s MDX script Know how to test the efficiency of the MDX you writeRead and apply the wisdom documented in the SQL Server 2008 Analysis Services Performance GuideBe creative – as an example, read and learn from David Shoyer’s A Different Approach to Implementing Time Calculations in SSAS paper

BTW, the Business Intelligence Wizard’s Time Intelligence feature is designed for novice cube developers

Cube Enhancements

ActionsGreat to enhance the user’s experience by making the UDM more interesting and relevantDrillthrough actions are limited to the data available in the cube

Consider using Reporting Services reports instead of lowering the grain of a measure group just to support drillthrough data

PerspectivesAre helpful to focus the user on a specific subject-areaCan be helpful to limit exploration in PPS analytic reports tooKeep in mind these are not designed to enforce permission sets

Use database roles to enforce permissions

Security

Define clearly named roles to describe purposeUse the role’s Description property to provide further details to help review its purpose

Avoid cell level security which can negatively impact on performance

Consider whether the allowing/denying dimension members can achieve the same outcome

SecurityContinued

Analysis Services only support Windows AuthenticationChallenging for:

Non-Windows clients“Double-hop” scenarios where the requesting user’s identity must be passed to the database

Configure KerberosConfigure dynamic security expressions

SecurityContinued

Configure dynamic security expressions by using the UserName() and CustomData() functions

UserName() returns the DomainName\UserName of the current connection CustomData() returns the value of the CustomData connection string property, if defined

Pass these functions into:MDX functions and statementsThe CALL statement to run a stored procedure

Requires the development and deployment of an assembly

demo

Demonstrations

Peter MyersMentorSolidQ

Related Content

Breakout SessionsDBI407 | Best Practices for Building Tier 1 Enterprise Business Intelligence Solutions with Microsoft SQL Server Analysis Services (Tue, 17 May, 8:30AM) – yesterday! So if you missed it, watch the recording.

Related Content

Recommened BooksThe Data Warehouse Toolkit: The Complete Guide to Dimensional Modeling (Second Edition) (Wiley), by Ralph Kimball and Margy RossExpert Cube Development with Microsoft SQL Server 2008 Analysis Services (PACKT Publishing), by Marco Russo, Alberto Ferrari and Chris WebbMicrosoft SQL Server 2008 Analysis Services Unleashed (SAMS), by Irina Gorbach, Alexander Berger and Edward Melomed

Related Content

SQL Server Articles (search http://microsoft.com)SQL Server 2008 Analysis Services Performance GuideSQL Server 2005 Analysis Services Distinct Count OptimizationSQL Server 2005 Analysis Services Many-to-Many Dimensions: Query Performance Optimization TechniquesIdentifying and Resolving MDX Query Performance Bottlenecks in SQL Server 2005 Analysis Services

What’s Next?

Follow, Tweet and Enter to win an Xbox Kinect Bundle

GAME ON! Join us at the top of every hour at the BI booth to compete in the Crescent Puzzle Challenge and Win Prizes

Sign up to be notified when the next CTP is available at: microsoft.com/sqlserver

@MicrosoftBI

/MicrosoftBI

Join the Conversation

Resources

www.microsoft.com/teched

Sessions On-Demand & Community Microsoft Certification & Training Resources

Resources for IT Professionals Resources for Developers

www.microsoft.com/learning

http://microsoft.com/technet http://microsoft.com/msdn

Learning

http://northamerica.msteched.com

Connect. Share. Discuss.

Complete an evaluation on CommNet and enter to win!

Scan the Tag to evaluate this session now on myTech•Ed Mobile

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.