EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB4047: What is the VLDB property "GROUP BY Non-ID Attribute"?


Community Admin

• Strategy


This article describes the purpose of the group by non-ID attribute setting in MicroStrategy

The SQL (Structured Query Language) specification requires that, in any query that performs aggregation (that is, which includes a formula such as “sum(column)” or “avg(column)”), all expressions in the SELECT clause that do not perform aggregation, such as attribute IDs or descriptions, must appear in the GROUP BY clause.
Attribute ID form expressions will always appear in the group by clause, because this is necessary to define the aggregation level for the query. Attribute description forms can be rendered into SQL in two ways. Strategy's default technique is to write description form expressions into the SQL Max() function. Because this expression is being aggregated, there is no need to include that expression in the group by clause. By default, the SQL takes the following general form:


SELECT
 b.ATTR1_ID,
 MAX(b.ATTR1_DESC),
 SUM(a.Fact)
FROM
 BASE a,
 LOOKUP_ATTR1 b
GROUP BY
 b.ATTR1_ID

 
In some environments, however, the following general SQL form may be preferred:
 

SELECT
 b.ATTR1_ID,
 b.ATTR1_DESC,
 SUM(a.Fact)
FROM
 BASE a,
 LOOKUP_ATTR1 b
GROUP BY
 b.ATTR1_ID,
 b.ATTR1_DESC

 
The Strategy SQL Generation Engine provides a Very Large Database (VLDB) property Called “GROUP BY Non-ID Attribute.” This property can be found at the project (database instance), template and report levels. The two possible values are as follows:

  • Use Max: Aggregates the attribute description using the MAX() function.
  • Use Group By: Does not aggregate the attribute description and the description column is included in the GROUP BY clause.
     
ka04W000000OhdSQAS_0EM440000002GKN.jpeg

“Use Max” generates SQL in the first (default) form shown above. If the second form is desired, administrators may choose the second option for this VLDB property.
It is possible that some databases, in some environments, may evaluate Max() for attribute description forms noticeably more quickly or slowly than the corresponding SQL using group by for description forms. Such cases are rare and the circumstances that might cause a significant performance differential are not known.
 


Comment

0 comments

Details

Knowledge Article

Published:

May 5, 2017

Last Updated:

May 5, 2017