Using WITH to Create Caches

Analysis Services

Analysis Services

Using WITH to Create Caches

As with named sets and calculated members, the WITH keyword is also used to create query level caches, usable for the lifetime of a single query. The following syntax is used to add the WITH keyword to the MDX SELECT statement:

[WITH <formula_specification>]
      [, <formula_specification>]
SELECT [<axis_specification>
       [, <axis_specification>...]]
  FROM [<cube_specification>]
[WHERE [<slicer_specification>]]

The <formula_specification> value for caches is further broken out in the following syntax definition:

<formula_specification> ::= CACHE AS '(<set>[, <set>...])'

The <set> value is the set expression used to create the cache. The <set> value can support the use of MDX set functions.

When using the <set> set expression for constructing a cache, the following rules apply:

  • Each <set> must contain members from only one dimension. Each member must be distinct.

  • Each <set> must be from a different dimension.

  • The <set> cannot contain measures.