For a conceptual understanding of virtual hierarchies, see Virtual hierarchies.
What is the difference between a virtual and a non-virtual hierarchy?
A non-virtual hierarchy collects all members from the database and stores them in the cube. For hierarchies with millions of members, this increases memory usage and loading time significantly. A virtual hierarchy defers member resolution to query time. Members are not stored in the cube, so the hierarchy has a smaller memory footprint and faster commit times. However, some operations that require pre-aggregated member data must fall back to database queries. For example, retrieving all the members of a level of a virtual hierarchy, or searching for a specific member, triggers a database query.How to declare a virtual hierarchy
To mark a hierarchy as virtual, callvirtual() when you build the hierarchy.
By default, Atoti resolves hierarchy level members whose type is numeric or string. For other level types, such as dates, provide a custom member-name-to-discriminator parser.
Set the custom parser through the level builder using the withMemberNameParserPluginKey method.
The following snippet shows a complete virtual hierarchy configuration:
What are the limitations of virtual hierarchies?
Virtual hierarchies do not support the full set of MDX operations available to non-virtual hierarchies.- Member navigation between hierarchy members, as performed in
LeadandLagmeasures, is not supported. - MDX expressions that describe a member expression must provide the full member path.
- MDX expressions that include a virtual hierarchy and do not include the
NON EMPTYkeyword trigger a database query. - A virtual hierarchy cannot be a slicing hierarchy.
- A level of a virtual hierarchy cannot be a distributing level. A data cube whose distributing level belongs to a virtual hierarchy refuses to join the query cube and stops its distribution.