SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Working with Windows Communication Foundation (WCF)
Transfer Logins Task and Transfer Database Task in SSIS
Practical Database Change Management (Part 2)
Practical Database Change Management (Part 1)

More     
 
Latest FAQ's

ALTER TABLE SWITCH statement failed because column '%.*ls' has data type ...
ALTER TABLE SWITCH statement failed because column '%.*ls' has data type ...
ALTER TABLE SWITCH statement failed. There is no identical index in ...
'%ls' statement failed because the expression identifying partition number for the ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008
ApexSQL Enforce

More     

articles >> business intelligence >> Optimizing Microsoft SQL Server Analysis Services: MDX ...

Optimizing Microsoft SQL Server Analysis Services: MDX Optimization Techniques: Optimizing NON EMPTY

By : William E. Pearson, III
Apr 20, 2004

Overview


In this article, we will explore the use of a calculated member property to optimize query performance. Almost anyone who has worked with MSAS for any length of time has become aware of the NON EMPTY keyword in MDX. Empty cells are the reason that most of us are thankful for the NON EMPTY option. Empty cells are a direct result of no data existing at the intersection of two or more dimension, and our MDX statements display them alongside the populated cells in the datasets rendered.
 

Empty cells have an impact on the evaluation of search conditions and value expression, but, perhaps more significantly from an information consumer perspective, they can adversely affect usability and compactness of the data returned from a query. If the data in a cube is sparse, for example, a query might deliver a dataset with a significant number of empty cells.
 

A simple illustration of the effect of empty cells on the displayed data might be seen by running the following query against the Warehouse cube of the FoodMart 2000 sample database that ships with MSAS.


SELECT


   {[Product].[Pearl Imported Beer]} ON COLUMNS,


   {[Store].[Store Name].Members} ON ROWS


FROM


   [Warehouse]


WHERE


   ([Measures].[Warehouse Sales])


A view of the dataset returned by the query, as shown in Figure 1, reveals the presence of many empty cells.
 


 

Figure 1: The Presence of Empty Cells in a Dataset

 

The empties occur because there is no data at most of the Product / Store intersects for Pearl Imported Beer: no transactions have transpired between the warehouses and many of the stores for this particular product within the times captured in the Warehouse cube. In cases like this, an easy method of “suppressing” the empties presents itself in the form of the popular NON EMPTY keyword. In short, NON EMPTY is used on a given axis to remove empty tuples prior to delivery of the result dataset.
 

Applying it to our previous example, we use the NON EMPTY keyword in the following fashion:


SELECT


   {[Product].[Pearl Imported Beer]} ON COLUMNS,


   NON EMPTY{[Store].[Store Name].Members} ON ROWS


FROM


   [Warehouse]


WHERE


   ([Measures].[Warehouse Sales])


All the Stores in the second axis (“rows”) dimension that have no values for Pearl Imported Beer are screened out of the result dataset before it is delivered to the client, as depicted in Figure 2.



Figure 2: NON EMPTY Screens Out the Empties


The NON EMPTY keyword in MDX allows us to screen out empty tuples, in actuality, not individual empty cells. As many of us have found (and as I see in a recurring question / complaint, both in web forums and in e-mails I receive from readers) empty cells can still appear in a dataset when the NON EMPTY keyword is employed in the query that generates it. This condition is best remedied by knowledgeable use of the keyword in writing the query, and will perhaps be the subject for a future article. Our focus in this article is another facet of the use of the NON EMPTY keyword, its effect upon query performance.

 


    Next Page>>    








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved