Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review DirectQuery in SSAS 2016, best practices and use cases

Similar presentations


Presentation on theme: "Review DirectQuery in SSAS 2016, best practices and use cases"— Presentation transcript:

1 Review DirectQuery in SSAS 2016, best practices and use cases
Microsoft Ignite 2016 9/24/ :58 AM BRK3285 Review DirectQuery in SSAS 2016, best practices and use cases Marco Russo SQLBI © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Agenda DirectQuery in SSAS 2016
What’s changed since 2012/2014 How to create a data model in DirectQuery mode Querying data models in DirectQuery mode What happens when you use DirectQuery Differences between clients: Excel and Power BI Security models Optimizing DirectQuery Best practices for DAX, data modeling, and data sources Leveraging columnstore indexes Final considerations When to use DirectQuery, Q & A

3 Storage engines in SSAS Tabular
VertiPaq Create a copy of data in memory Single access to data source Queries run on a “snapshot” of data DirectQuery Queries sent to data source, SSAS Tabular does not “cache” data No processing time Real-time queries Higher workload on data source

4 DirectQuery vs VertiPaq (SSAS 2016)

5 VertiPaq pros/cons Pros Cons Data compressed in memory, faster queries
Different data sources for one model Single scan of source tables Cons Processing takes time (latency of updates) Processing requires CPU time Limited querying capacity during process All data have to fit in memory Copy data from data source to SSAS Network could be one bottleneck

6 DirectQuery pros/cons
No processing time No limits of data size related to memory No data duplication No latency in updates Cons Data slower to query Specific optimizations on data source Only one data source for one model Larger workload on data source for queries

7 DirectQuery evolution
SSAS 2012/2014 Support only for SQL Server, no other RDBMS Support only for DAX queries, no MDX One DAX query equal to one SQL query No cache in SSAS No formula engine in SSAS Limited support to DAX language No security roles SSAS 2016 Support for several RDBMS (also non-MS) Support for DAX and MDX queries Multiple SQL queries for one MDX/DAX query Partial cache in SSAS Formula engine support in SSAS Full DAX language in query/measures Security roles supported

8 Supported data sources
Microsoft Microsoft SQL Server 2008 and later Microsoft Azure SQL Database Microsoft Azure SQL Data Warehouse Microsoft Azure SQL Analytics Platform System (APS) Oracle Oracle 9i and later Teradata Teradata V2R6 and later List of specific providers supported for DirectQuery:

9 Demo Create a Tabular model in DirectQuery mode

10 Set DirectQuery Mode property

11 Set DirectQuery Mode property

12 Use DirectQuery connection mode

13 Developing for DirectQuery
Using default partitions Switch between On/Off for DirectQuery Mode Features unlimited when DirectQuery = Off You cannot switch to On if the model uses unsupported features Using sample data Create one or more partitions with sample data Default partition is DirectQuery only – no preview in SSDT Switch to DirectQuery after deployment (SSMS) You can change the DirectQuery mode after deployment Use Database Properties in SSMS, or XMLA, or PowerShell

14 Demo Sample data in SSDT Switch DirectQuery in SSMS

15 Sample partition in SSDT

16 Switch DirectQuery in SSMS

17 Limitations in Tabular models for DirectQuery
Data modeling No calculated tables DAX All functions supported in measures and queries Restrictions in calculated columns and row-level security (RLS) filters Detailed list of functions available at MDX No relative object names No session-scope MDX statements No tuple with member from different levels in subselects No used-defined hierarchies Detailed list of MDX limitations available at

18 What happens in DirectQuery mode
Optimizing DirectQuery  optimizing RDBMS Understand how SQL queries are generated by SSAS Tabular Create indexes to improve performance Design data model and DAX expressions to improve efficiency of SQL code Tools SQL Profiler DAX Studio

19 Demo Analyze queries using SQL Profiler and DAX Studio

20 Differences between clients
Excel PivotTable Generates MDX queries No cache at the SSAS layer Repeating the same drilldown repeats the SQL queries Multiple subqueries repeat same queries at different granularities PivotTable in Excel Power BI Multiple DAX queries in the same request Strong caching at Power BI application level Repeating the same drilldown reuse previous results Explicit Refresh required to empty client cache enforcing SQL queries to read data More efficient DAX queries Reduced number of SQL queries sent for the same report

21 Tuning query limits in DirectQuery
Limit results in SQL queries Default: 1 million rows Avoid long running queries and memory issues Only affects queries returning large intermediate results to SSAS (it depends on DAX expressions) Can be configured through MaxIntermediateRowsetSize setting in msmdsrv.ini <ConfigurationSettings> <DAX> <DQ> <MaxIntermediateRowsetSize> </MaxIntermediateRowsetSize> </DQ> </DAX> . . .

22 Security Role based security Impersonation with DirectQuery
Same rules defined by DAX filter expressions, one for each table Dynamic security using windows username DAX filters translated in corresponding SQL filters (WHERE conditions) Performance depends on data source optimization Every SQL query repeats the security filter Impersonation with DirectQuery SQL queries sent to RDBMS using the credentials of user connected to SSAS SQL Server 2016 has its own row-level security RDBMS must support Windows Integrated authentication Can replace role based security in SSAS, but you can also use both at the same time

23 Demo Role based security Impersonation with DirectQuery

24 Optimizing DirectQuery
Optimize DAX Use optimized DAX functions in DAX measures and queries Reduce complex calculations in aggregations (materialize calculated columns in RDBMS) Optimize data model Enable referential integrity in relationships It will generate INNER JOIN instead of LEFT JOIN Careful consider bidirectional filters Optimize RDBMS Columnstore index Indexed views

25 Demo Optimize data model and RDBMS

26 Scenarios for DirectQuery
Small database updated often DirectQuery removes latency caused by data refresh Data is always up-to-date Large database that cannot fit in memory Removes processing time Does not require large hardware for Analysis Services (reduced memory requirements) VertiPaq is usually faster than DirectQuery, but you need SSAS memory to store the entire database

27 Recap and call to action
DirectQuery in SSAS 2016 Huge improvements over 2012/2014 Larger number of use cases where it can be used (now it also supports Excel as a client) Design models for DirectQuery mode Consolidate calculated columns on RDBMS for performance Use referential integrity assumption in relationships Choose between different security models Optimizing DirectQuery You have to optimize the RDBMS Columnstore indexes are a primary tool for SQL Server Use cases for DirectQuery Small database updated often Large database that cannot fit in memory

28 Free IT Pro resources To advance your career in cloud technology
Microsoft Ignite 2016 9/24/ :58 AM Free IT Pro resources To advance your career in cloud technology Plan your career path Microsoft IT Pro Career Center Cloud role mapping Expert advice on skills needed Self-paced curriculum by cloud role $300 Azure credits and extended trials Pluralsight 3 month subscription (10 courses) Phone support incident Weekly short videos and insights from Microsoft’s leaders and engineers Connect with community of peers and Microsoft experts Get started with Azure Microsoft IT Pro Cloud Essentials Demos and how-to videos Microsoft Mechanics Connect with peers and experts Microsoft Tech Community © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

29 Please evaluate this session
9/24/ :58 AM Please evaluate this session Your feedback is important to us! From your PC or Tablet visit MyIgnite at From your phone download and use the Ignite Mobile App by scanning the QR code above or visiting © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

30


Download ppt "Review DirectQuery in SSAS 2016, best practices and use cases"

Similar presentations


Ads by Google