<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Microsoft SQL Server Support Blog : SQL Programmability</title><link>http://blogs.msdn.com/sqlblog/archive/tags/SQL+Programmability/default.aspx</link><description>Tags: SQL Programmability</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Reporting Services Staaaarrrrrtttt Up</title><link>http://blogs.msdn.com/sqlblog/archive/2007/11/09/reporting-services-staaaarrrrrtttt-up.aspx</link><pubDate>Sat, 10 Nov 2007 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6028608</guid><dc:creator>sqlblog</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/sqlblog/comments/6028608.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlblog/commentrss.aspx?PostID=6028608</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sqlblog/rsscomments.aspx?PostID=6028608</wfw:comment><description>&lt;P&gt;I hear the complaint a lot that after a time period of no calls to Reporting Services, the first call to the Reporting Services instance is very slow.&amp;nbsp; This is totally expected because the application pool generally gets spun down and we need to restart everything.&lt;/P&gt;
&lt;P&gt;If you wire up some basic web service calls, you can see that (at least in my testing) the RS2005 web service takes approximately 30 seconds to start up.&amp;nbsp; The only database work done here is the bare minimum necessary to retrieve the encryption keys and configuration settings stored in the catalog database.&amp;nbsp; There is no access to actual datasources or reports.&lt;/P&gt;
&lt;P&gt;First, I wrote a&amp;nbsp; basic web method that just returns an empty dataset:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Public Function ReturnBlankDataSet() As Data.DataSet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim m_ds As New Data.DataSet&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return m_ds&lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then, I wrote some code that had the ability to make a call to a web service and timed how long it took to return from the web method call.&amp;nbsp; I ran the test against each web service five times.&amp;nbsp; In between each test, I did an IIS reset to ensure a cold start.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;My test harness code looked like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim sr As New IO.StreamWriter("c:\ReportingServicesMetrics.txt")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'let's loop through 5 times&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For i As Integer = 0 To 4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ts As DateTime&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim te As DateTime&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'let's reset IIS to make sure everything has to start from scratch&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("Doing an IISReset - Loop #" &amp;amp; (i + 1).ToString)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim proc As New Diagnostics.Process&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc.StartInfo.FileName = "iisreset"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc.Start()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc.WaitForExit()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("IIS has been reset")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'RS&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("Getting ready to instantiate the RS web service")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ts = Now()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim rs As New RS2005.ReportingService2005&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim creds As New Net.NetworkCredential&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; creds = Net.CredentialCache.DefaultCredentials&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Credentials = creds&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.Url = "http://servername/reportserver2005/reportservice2005.asmx"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.ListChildren("/", False)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("Instantiated the RS web service")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; te = Now()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("RS took " &amp;amp; te.Subtract(ts).TotalMilliseconds.ToString)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'dummy web service&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("Getting ready to instantiate the dummy web service")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ts = Now()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dws As New DummyWebService.Service&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dws.ReturnBlankDataSet()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("Instantiated the dummy web service")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; te = Now()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.WriteLine("The dummy web service took " &amp;amp; te.Subtract(ts).TotalMilliseconds.ToString)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sr.Close()&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;I did a FileMon on the startup for each process.&amp;nbsp; The dummy web service did about 130 file reads, while Reporting Services did almost 17000 reads.&amp;nbsp; This is because Reporting Services must load up the traditional ASP.NET assemblies, plus all of the specialized Reporting Services assemblies.&amp;nbsp; It also loads up all the localization files for all the various supported languages.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Reporting Services does a good bit of logging for both ReportServer, Report Manager, and the Report Server Windows Service.&amp;nbsp; I did not do test with logging turned off because we ship with a default level of logging, you could save some start up time by turning off all logging.&amp;nbsp; However, it is&amp;nbsp; not recommended to turn off logging&amp;nbsp; because of the value traditionally derived from standard logging.&lt;/P&gt;
&lt;P&gt;Other things that cause additional overhead when Reporting Services starts up:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Every time the SRS 2005 web service loads, it also has to read and decrypt the rsreportserver.config file &lt;/LI&gt;
&lt;LI&gt;Since there are no connections in the connection pool, we have to physically open up a socket connection between the two servers, plus log into the database instance&lt;/LI&gt;
&lt;LI&gt;The web service has to make RPC calls into the Windows Service to get the symmetric encryption key&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;This explanation is to try and provide an overview of some of the things that are going on during Reporting Services initial start up.&amp;nbsp; Remember, most of these things probably do not happen in traditional web applications. Again, all of this is completely expected behavior.&lt;/P&gt;
&lt;P&gt;As discussed earlier, if this behavior causes some business issues, you could consider modifying the recycle options on your IIS process.&amp;nbsp; You can either increase the recycle time (causing them to be recycled less frequently) or schedule the recycle to occur at a non-peak time.&amp;nbsp; You could then combine this second option with a "ping" process that hits the process shortly after the recycle.&amp;nbsp; This will "wake" the ReportServer processes so that your initial customer doesn’t see the initialization time.&amp;nbsp; If you combine these options with turning off the idle worker process shutdown, you can significantly minimize the instances where a user would run into the startup delay.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The only downside I can see to not idling the worker process is that the process could consume more resources than necessary.&amp;nbsp; Recycling from time to time is recommended because it cleans up the worker process if you have any leaked memory or fragmentation but it is not necessary from a technical perspective.&lt;/P&gt;
&lt;P&gt;Unfortunately, none of this information is documented in any KB articles.&amp;nbsp; However, some of it is addressed in &lt;A href="http://www.microsoft.com/technet/prodtechnol/sql/2005/pspsqlrs.mspx" mce_href="http://www.microsoft.com/technet/prodtechnol/sql/2005/pspsqlrs.mspx"&gt;www.microsoft.com/technet/prodtechnol/sql/2005/pspsqlrs.mspx&lt;/A&gt;.&amp;nbsp; Beyond the counters in the performance document, you could also track the performance of your Reporting Services instance using some execution log reports (&lt;A href="http://msdn2.microsoft.com/en-us/library/ms161561.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms161561.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms161561.aspx&lt;/A&gt;).&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-weight: bold"&gt;&lt;STRONG&gt;Posted By: Evan Basalik&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6028608" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Tips+and+Tricks/default.aspx">SQL Tips and Tricks</category><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Reporting+Services/default.aspx">SQL Reporting Services</category><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Programmability/default.aspx">SQL Programmability</category></item><item><title>Working around the 4.2 billion tuple calculation limit in Analysis Services 2005 is possible in some cases...</title><link>http://blogs.msdn.com/sqlblog/archive/2007/11/06/working-around-the-4-2-billion-tuple-calculation-limit-in-analysis-services-2005-is-possible-in-some-cases.aspx</link><pubDate>Tue, 06 Nov 2007 23:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5943060</guid><dc:creator>sqlblog</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sqlblog/comments/5943060.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlblog/commentrss.aspx?PostID=5943060</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sqlblog/rsscomments.aspx?PostID=5943060</wfw:comment><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;An Analysis Services 2005 query against a calculation on a cell may report the error:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;"The expression contains a function that cannot operate on a set with more than 4,294,967,296 tuples."&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This may be because there are simply more underlying cells in the query than the supported maximum, but in some cases, the query can be rewritten to avoid the error by breaking out parts of a clause into other clauses.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Specifically, an IIF() statement apparently considers the total number of cells for calculation from both action clauses when counting the number of underlying cells.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;But two IIF statements run within the same query are not counted together when the server code checks for this limit.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Each appear to be evaluated seperately, and so long as neither exceeds the 4.2B tuple limit, the query will pass the check and not fail in this way.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;Here is an example of a calculation that produced this error when run for a high level cell in a relatively large database:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;IIF(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Condition=true,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Expression 1,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Expression 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;Replacing the query with the following achieved the same results, but avoided the error:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;IIF (&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Condition = true,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;NULL,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Expression 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;+&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;IIF(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Condition = true,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;MDX Expression 1,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;NULL&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;This approach allows Analysis Services to take advantage of internal optimizations since it can eliminate all cells for the first condition with NULL results, regardless of the context of the calculation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The server is able to use "block mode" evaluation in the formula engine that does not require each result to be evaluated on a cell by cell basis.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This optimization may also improve performance in some cases for the same reason.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 7.5pt; FONT-FAMILY: 'MS Sans Serif','sans-serif'; mso-bidi-font-family: 'MS Sans Serif'; mso-fareast-language: EN-US"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;o:p&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-weight: bold"&gt;&lt;STRONG&gt;Posted By: Jon Burchel&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5943060" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Tips+and+Tricks/default.aspx">SQL Tips and Tricks</category><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Programmability/default.aspx">SQL Programmability</category><category domain="http://blogs.msdn.com/sqlblog/archive/tags/SQL+Analysis+Services/default.aspx">SQL Analysis Services</category></item></channel></rss>