Presentation is loading. Please wait.

Presentation is loading. Please wait.

ROLAP partitioning in MS SQL Server 2016

Similar presentations


Presentation on theme: "ROLAP partitioning in MS SQL Server 2016"— Presentation transcript:

1 ROLAP partitioning in MS SQL Server 2016
Proof of concept with change queries, sample DB and VS project

2 What is included in this presentation
.rar file on 6th slide with Visual Studio project and SQL, MDX and XMLA queries to see how MOLAP and ROLAP partitions work .rar has Sample OLTP working database .rar contains Steps.txt file with steps how to configure permissions for SSAS service account used by Cubes to get data and retrieve notification about changes in OLTP Dimension partitioning Defining slices for cube partitions

3 Content: Theory of partitioning and difference between ROLAP and MOLAP partitions in cube and dimension 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project Conclusion and other sources

4 Theory of partitioning and difference between ROLAP and MOLAP partitions in cubes
To get fresh data in SSAS MOLAP cube processing is needed This could take significant amount of time. Negative impact is a lag in displayed data Solution – use ROLAP cube, which retrieves data directly from OLTP database without processing ROLAP cube is slower than MOLAP cube because data needs to go from OLTP to SSAS database. See picture on next slide. Partitions in cube could be separated into to MOLAP part and ROLAP part. MOLAP part needs to be processed go get fresh data while ROLAP part goes directly to OLTP database to get data. Such a cube, will take majority of data from MOLAP partition (like all years before) and last year takes from ROLAP partition. To get desired results, ROLAP have smaller portion of data than MOLAP. Result – Fast cube (slower than pure MOLAP) but with actual data (actual for last year)

5 Theory of partitioning and difference between ROLAP and MOLAP partitions in cubes

6 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
For demonstration of ROLAP partitioning use sample database in folder Databases + installation “Steps.txt” Be careful about permissions. To make ROLAP cube work is needed to setup correct permissions for SSAS Service account in OLTP Server with ALTER Trace permission. Without this, partition in cube will not get notification about changed data and will not know, that something changed in data.

7 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
ROLAP cubes have two partitions, divided according date dimension Two cubes “AmountROLAPtableBinding” and “AmountROLAPqueryBinding” have two partitions for each – one MOLAP (previous years) and one ROLAP (current year) Cube “AmountMOLAP” has one MOLAP partition See queries in folder /Queries. Run “Measure Change Queries.sql”. There are two inserts which write new sale of product with today’s date. Last select displays results, which should give MDX queries. MDX queries against ROLAP cubes give the same result as SQL query MDX query against MOLAP cube gives the same result after processing database by running XMLA script in “Process SSAS db.xmla” file. Run change query again and see difference

8 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
Two scenarios exist for splitting data into partitions Table binding – use separate views to get divided data Query binding – use one source and according SQL Query, SSAS divides data into partitions. A “Where” clause in SQL query is mandatory in this case See cube’s “AmountROLAPtableBinding” partitions and their sources. Click on three dots and will see “Table binding” setup. For cube “AmountROLAPqueryBinding” is option “Query binding” picked up and appropriate SQL Query is provided. See “Slice” property for every partition. There is MDX query, which tells to SSAS engine which partition to touch to get data. Appropriate ROLAP partition is identified in SSAS engine running MDX query and SQL query goes to OLTP to get data. This is not happening automatically – notification about data change needs to come into SSAS engine. ROLAP mode is kind of MOLAP mode with enabled “Proactive caching” with zero latency and enabled notifications.

9 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
If notifications are not setup properly (alter trace permission is not granted to Service account on Server level and “db_datareader” on DB level) ROLAP partition works as MOLAP partition Last setup for partitions is “Slice” property. Slice provides full control about partitions, which will be used for MDX queries, and full speed of the source of data. It is officially recommended as “Good practice” to define slice property for every partition. But, MDX query in this property has several restrictions. We cannot use “Generate” or range “:” to generate data, what restricts significantly MDX queries to define parts of data. List of members could be generated dynamically during object processing by SSIS job. In this example I use simple dividing by years and list all years of Time dimension

10 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
Same steps are needed as for Measure partitioning until one bug in VS. Go to dimension properties (not member properties), choose storage mode ROLAP and proactive caching “Real-time ROLAP”. But after successful deployment and processing of DB I get error in DB engine running MDX query in SSMS. There is one setting in property “Error Configuration”. After changing dimension mode to ROLAP, VS automatically changes dimension’s “Error Configuration” property to “Custom”. This causes errors during running MDX queries. Change this property “Default” and process. MDXs should run without error now. After this change I changed “Error Configuration” property back to “Custom” and it works also.

11 2. Use case with part of WWI (World Wide Importers) on SQL Server 2016 and VS 2015 project
To test ROLAP functionality in dimension Customers us second query in file “Dimension Change Queries.sql”. Updates change CustomerID from 83 to in source database. MDXs use CustomerID = 83, so there will be no result This change proves, that dimension “Customers” is in ROLAP mode so change in OLTP reflects immediately Change influences also MOLAP cube, because use the same ROLAP dimension “Customers”

12 3. Conclusion and other sources
Benefits – it is possible to have actual data from not processed cube This makes sense for large cubes, where processing take more time Cons - changes in OLTP which does not fall in basket of ROLAP partition are not reflected in these cubes until processing See article about how SSAS works with partitions and slice queries: See link how to setup SSIS job to generate slice queries during cube processing In case of interest about this area, help with configuration or comments please contact me via LinkedIn - “Andrej Zafka” or via Thank you for reading till end


Download ppt "ROLAP partitioning in MS SQL Server 2016"

Similar presentations


Ads by Google