Databases Reference
In-Depth Information
Query Execution Stages
When a client's request comes to Analysis Services, it passes through multiple stages. First,
Analysis Services has to parse and analyze the Simple Object Analysis Protocol (SOAP) and
XML for Analysis (XML/A) portions of the request, retrieve the MDX statement, and parse
it. (We discussed the phases that precede the parsing of an MDX statement in Chapter 26,
“Server Architecture and Command Execution.”) After the system has determined what
query language is used in the request, and if it detects that request contains an MDX
query, it passes the execution of the request to the server subsystem responsible for execu-
tion of the MDX request—the formula engine.
The server architecture diagram in Figure 29.1 shows how Analysis Services processes an
MDX query and illustrates the server subsystem responsible for each step of the process.
The process shown in Figure 29.1 traces the execution of MDX queries by the formula
engine subsystem:
1. The command parser parses the MDX statement and produces an Abstract Syntax
Tree (AST).
2. Analysis Services traverses the AST, resolves the names of the objects referenced in
the query, and validates the signatures of the functions. This phase produces an
expression tree.
3. After an expression tree is created, Analysis Services generates a collection of Scope
objects. Each Scope object contains calculations that have a certain level of availabil-
ity. For example, calculations created in MDX script reside in the global scope, calcu-
lations created in the sessions reside in the session scope, and so on. (For more
information about MDX calculations, see Chapter 12, “Cube-Based MDX
Calculations.”)
4. Analysis Services performs static analysis of each node of the expression tree and
produces a normalized tree. This is a new step in the query execution introduced in
Analysis Services 2008; we discuss it later in this chapter.
5. Analysis Services executes the query. It starts the execution by evaluating the multi-
dimensional space covered by the query. As a result of evaluating axes definitions,
Analysis Services produces a virtual set operation tree. (We talk about the virtual set
operation tree later in this chapter.)
6. Analysis Services iterates over the multidimensional space defined by the normalized
tree and calculates cell values. While calculating cell values, Analysis Services first
builds logical execution plan, which enables the system to walk through different
allowed code paths and choose the most optimal one.
7. Analysis Services creates a physical execution plan.
8. If the query has a NON EMPTY operator, Analysis Services optimizes the multidimen-
sional space and removes empty tuples. For more information about NON EMPTY
operator, see Chapter 11, “Advanced MDX.”
Search WWH ::




Custom Search