6/12/2018 2:19 PM BRK3245 DirectQuery in Analysis Services: best practices, performance, and use cases Marco Russo SQLBI © Microsoft Corporation. All rights.

Slides:



Advertisements
Similar presentations
Review DirectQuery in SSAS 2016, best practices and use cases
Advertisements

Success through People with LinkedIn and O365
Successfully migrate existing databases to Azure SQL Database
What’s new in Entity Framework Core 2.0
5/22/2018 1:39 AM BRK2156 Power BI Report Server: Self-service BI and enterprise reporting on-premises Christopher Finlan Senior Program Manager © Microsoft.
Creating Enterprise Grade BI Models with Azure Analysis Services
Azure on Steroids: Full Automation with PowerShell
Azure File Sync Setup, configuration and management
Delivering enterprise BI with Azure Analysis Services
Microsoft /2/2018 3:42 PM BRK3129 Query Big Data using the Expanded T-SQL footprint with PolyBase in SQL Server 2016 Casey Karst Program Manager.
Use any Amazon S3 application with Azure Blob Storage
Azure Cloud Shell Magic of Modern Command-line Management
6/16/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Developing Hybrid Apps on Microsoft Azure Stack
6/19/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Data Platform and Analytics Foundational Training
Modernizing your Remote Access
Optimizing Microsoft OneDrive for the enterprise
Performing a Seamless Migration in Azure SQL DB
Build /4/2018 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
What a Real, Functioning DevOps Team Looks Like
7/22/2018 9:21 PM BRK3270 Building a Better Data Solution: Microsoft SQL Server and Azure Data Services Joey D’Antoni Principal Consultant Denny Cherry.
SQL Server on Linux on All-Flash Arrays
Microsoft Ignite /31/ :08 AM
Julie Strauss Senior Program Manager Microsoft
8/6/ :17 AM THR2214 Hybrid Cloud Activated A customer case study optimizing on-premises & Azure performance and cost Mor Cohen-Tal Senior Product.
Excel and Power BI Better Together Democratization of data
SQL Server for Java developers
Workflow Orchestration with Adobe I/O
Customize Office 365 Search and create result sources
Find, try and get line-of-business apps on Microsoft AppSource
Build advanced PowerApps that work offline!
Automate all things! Microsoft Azure continuous deployment
Modern Front-End Web Development with Visual Studio
Agile Planning with Visual Studio Team Services (VSTS)
Servicing Windows 10 in the Real World
9/22/2018 3:49 AM BRK2247 Learn from MVPs: Panel discussion on all things SharePoint and OneDrive © Microsoft Corporation. All rights reserved. MICROSOFT.
Azure PowerShell Aaron Roney Senior Program Manager Cormac McCarthy
Enriching your BI Semantic Models with Data Analysis Expressions (DAX)
11/22/2018 1:43 PM THR3005 How to provide business insight from your data using Azure Analysis Services Peter Myers Bitwise Solutions © Microsoft Corporation.
Azure Advisor: Optimization in the best way
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
PowerShell Unplugged Jeffrey Snover Technical Fellow
Mobile Center and VSTS:​ Better together for your Mobile DevOps
Microsoft products for non-profits
Power-up NoSQL with Azure Cosmos DB
Five cool things you can do with Windows PowerShell on Office 365
What do YOU get from SharePoint Hybrid?
Microsoft To-Do Preview
Securely pass passwords into your deployment
Microsoft Exchange: Through the eyes of MVPs (Panel discussion)
MDM Migration Analysis Tool (MMAT)
TechEd /15/2019 8:08 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Overview: Dynamics 365 for Project Service Automation
Virtual Reality with Azure and Unity
Surviving identity management in a hybrid world
Breaking Down the Value of A Yammer Post: 20 Things to Do
Cool Microsoft Edge Tips and Tricks
When Bad Things Happen to Good Applications
Getting the most out of Azure resources with Azure Advisor
“Hey Mom, I’ll Fix Your Computer”
4/21/2019 7:09 AM THR2098 Unlock New Opportunities with Nintex Hawkeye Process Intelligence and Workflow Analytics Sr. Product.
Enriching your BI Semantic Models with Data Analysis Expressions (DAX)
Consolidate, manage, backup, and secure your cloud content
Designing Bots that Fit Your Organization
Ask the Experts: Windows 10 deployment and servicing
Passwordless Service Accounts
Digital Transformation: Putting the Jigsaw Together
Diagnostics and troubleshooting in Azure App Service Support Center
Optimizing your content for search and discovery
Presentation transcript:

6/12/2018 2:19 PM BRK3245 DirectQuery in Analysis Services: best practices, performance, and use cases Marco Russo SQLBI © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Agenda DirectQuery in SSAS 2016/2017 (and Azure AS) 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

Whitepaper DirectQuery in Analysis Services 2016 https://www.sqlbi.com/articles/directquery-in-analysis-services-2016/ Include demos and further details about the content of this presentation All the considerations are still valid in Analysis Services 2017 and Azure Analysis Services as of September 2017

Storage engines in SSAS Tabular In-Memory (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

DirectQuery vs In-Memory (VertiPaq)

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

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

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/2017 – Azure AS 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

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: https://msdn.microsoft.com/en-us/library/hh230898.aspx

Demo Create a Tabular model in DirectQuery mode

Set DirectQuery Mode property

Set DirectQuery Mode property

Use DirectQuery connection mode

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

Demo Sample data in SSDT Switch DirectQuery in SSMS

Sample partition in SSDT

Switch DirectQuery in SSMS

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 https://msdn.microsoft.com/en-us/library/mt723603.aspx 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 https://msdn.microsoft.com/en-us/library/hh230898.aspx

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

Demo Analyze queries using SQL Profiler and DAX Studio

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

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>1000000 </MaxIntermediateRowsetSize> </DQ> </DAX> . . .

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

Demo Role based security Impersonation with DirectQuery

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

Demo Optimize data model and RDBMS

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

Recap and call to action DirectQuery in SSAS 2016/2017 and Azure AS 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

Whitepaper DirectQuery in Analysis Services 2016 https://www.sqlbi.com/articles/directquery-in-analysis-services-2016/

Please evaluate this session Tech Ready 15 6/12/2018 Please evaluate this session From your Please expand notes window at bottom of slide and read. Then Delete this text box. PC or tablet: visit MyIgnite https://myignite.microsoft.com/evaluations Phone: download and use the Microsoft Ignite mobile app https://aka.ms/ignite.mobileapp Your input is important! © 2012 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.

6/12/2018 2:19 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.