Chris Webb's BI Blog

Analysis Services, MDX, PowerPivot, DAX and anything BI-related

MDX Script Performance Analyser

with 3 comments

I do a lot of performance tuning as part of my consultancy work, and quite often when I start looking at a customer’s cube I find that for any given query that needs to be tuned there are several (sometimes hundreds) of calculations which affect the cells in the query and which could be the cause of performance problems. To help me work out which calculations are the ones that need to be looked at I put together a tool – the MDX Script Performance Analyser – which I’ve just got round to putting up on Codeplex so it can be shared:
 
Basically what it does is this:
  • First of all, you connect to the cube that your query runs against
  • Then you enter your query in the text box at the top of the screen and hit ‘Run Query’
  • This then starts the following process:
    • The tool reads the cube’s MDX Script and splits it up into its constituent statements, storing them in an array
    • It executes a Clear Cache command to ensure that all queries are run on a cold cache
    • It executes a Clear Calculations command so that for the current session the cube appears as though its MDX Script contains no commands
    • For each statement in the array of statements from the MDX Script, it then:
      1. Executes the first statement in the MDX Script within the session, so that the cube now acts as though its MDX Script contains only this statement and all previously executed statements
      2. Runs the query you entered in the textbox
      3. Stores how long the query took to run, plus other interesting metrics
    • Once the query has run on the equivalent of the entire MDX Script in the cube, a report is generated which contains graphs and charts illustrating the data captured earlier

As a result you get to see how much each calculation has contributed to the overall time taken by the query; when you see a big jump upwards in the query time graph (that isn’t followed by a big fall subsequently – which could happen with scoped assignments) then at that point in the MDX Script there’s an expensive calculation.

As you’ll see if you download the source code it is in a very basic state at the moment, but it works most of the time for me and has come in very handy on a number of occasions. There are a lot of changes and improvements that I’d like to make (such as recording the total number of cells returned by the query, the total number of non-empty cells and the number of Query Subcube events at each step) and if anybody out there has other suggestions or would like to sign up as a developer I’d be only too happy to hear from you.

I also need to thank Greg Galloway for making some invaluable contributions to the code and for fixing at least one critical bug for me. This is probably also a good point to mention another project on Codeplex that Greg and Darren Gosbell have been working on over the last few months, BIDS Helper:
http://www.codeplex.com/bidshelper

… which contains some really useful extra functionality for people working with AS in BI Development Studio.

Written by Chris Webb

April 20, 2007 at 12:20 pm

Posted in MDX

3 Responses

Subscribe to comments with RSS.

  1. Hi Chris,Thanks for the script. I will have to try it out. Can it be used in AS 2000?

    Ibrahim

    April 20, 2007 at 3:30 pm

  2. No, I\’m afraid this is AS2005 only.

    Chris

    April 20, 2007 at 3:38 pm

  3. Hi.. My script portuguess?

    Andre

    December 17, 2008 at 12:18 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 3,081 other followers

%d bloggers like this: