Wednesday, October 30, 2013

MOLAP Vs ROLAP

Which one is the best option among-st MOLAP and ROLAP ?, This one is very common question came across most of the newbie SSAS developers and the answer to this question is "Depends on the requirement"...............So Today I am going to talk on this topic.

MOLAP (Multi-dimensional Online Analytical Processing):

When you select MOLAP storage mode and process partitions, it stores a copy of source data and aggregations in a multi-dimensional structure in analysis services server. You can expect a good query performance if you are using MOLAP storage mode because MOLAP structure is highly optimized to maximize query performance and queries fetch data from multidimensional structure instead of source data. Aggregations also help in maximizing query performance.

Advantages:
   1. Good query performance than ROLAP
   2. If your cube is processed then you can access cube data even if you don't have relational source data  available

Disadvantages:
   1. Cube data gets updated only if you process cube (dimensions and partitions) so latency is high
   
Most of the organizations use MOLAP storage mode because they want high query performance for which OLAP systems are widely used. If your client is ready to work on one day prior data then its always better to use MOLAP storage mode because you will get good reporting performance and you can automate daily processing of your cube data through SQL Server jobs

ROLAP (Relational Online Analytical Processing):

When you use ROLAP storage mode, it does not store a copy of source data in the Analysis services. Aggregations of the partition also get stored in indexed views in the relational database. When you execute a MDX query on a cube having ROLAP storage mode, it first check the cache engine and if cache engine does not return data then it access the indexed views to answer a query hence it gives poor query performance than MOLAP.

Advantages:
     1. As data always get fetched from relational source, data latency is low or almost none
     2. Users always get current data without processing cube

Disadvantages:
     1. Poor query performance

If your client always need current data from relational data source and they are not worried about query performance then you can use ROLAP storage mode but you will surely see poor query performance as compared to MOLAP storage mode.

There are few other disadvantages of ROLAP mode like you cannot use MIN or MAX aggregate functions. you cannot use Views for creating your DSV. You can refer BOL article for more details.

Wednesday, October 16, 2013

MDX EXISTING keyword

Today I am going to talk about MDX "EXISTING" keyword. Seems the details provided on technet article is slightly complex to understand for a newbie developer hence I thought its better to share the details so that everyone can understand the basic usage of it.

Details: EXISTING keyword forces a specified SET to be evaluated within the current context.

Syntax: EXISTING Set_Expression

Example:

Consider a requirement wherein you want to COUNT the number of Products present under each Category. In such requirements you can build MDX using EXISTING keyword which actually explains the usage of keyword too. So we need to write a MDX query in following way for the requirement we have mentioned above.

WITH
  MEMBER [Measures].[X] AS
    COUNT([Product].[Product].[Product].MEMBERS)
  MEMBER [Measures].[Y] AS
    COUNT((EXISTING [Product].[Product].[Product].MEMBERS))
SELECT
  {
    [Measures].[X]
   ,[Measures].[Y]
  } ON 0
 ,[Product].[Category].[Category].MEMBERS ON 1
FROM [Adventure Works]

Output:


If you check the output, you will find that X is returning count of all products whereas Y is returning count of products belongs to each Category because we have given Product Category attribute on rows hence the set of products are evaluating under the context of Category.