Quantcast
Channel: SCN: Message List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 8968

Re: Analytic View Modeling: Using attribute on fact instead of attribute view?

$
0
0

After some further investigation, it looks like the answer is pretty clear. To get this behavior to work (only executing joins when a non-joined attribute column is used), simply use a left outer join. The plan optimizer seems to be aware that the joined column has the natural key and no join is required when just using that column in a left outer.

 

There should be no need to create the additional aliased fields for use in referential joins as discussed above except for the cases when an inner join is truly required (for referential join). Typically, fact to dimension joins (with SAP data) are going to be a left outer anyhow - not every row in COPA (for example) will have a Plant or Material populated - so an inner would 'drop' values from the measures where these are null - which is undesirable behavior in most cases.

 

Anyhow, to the details on how I examined both approaches:

 

- Created an analytical view with two attached attribute views

- One was joined N:1 with a referential join

- One was joined N:1 with a left outer join

- Create statements to test 4 scenarios (use joined column, use attribute column for both the Left and Referential joins)

 

Capture.JPG

-- SELECT only joined column from a Left Outer
SELECT AT_BUSINESS_UNIT_MATNR, SUM(VVREV) FROM "_SYS_BIC"."copa poc/AN_COPA/olap"
GROUP BY AT_BUSINESS_UNIT_MATNR

 

No join to attribute view is executed, self only

Capture1.JPG

 

-- SELECT only joined column from a Referential
SELECT MATNR, SUM(VVREV) FROM "_SYS_BIC"."copa-poc/AN_COPA/olap"
GROUP BY MATNR

 

Join is executed

Capture2.JPG

 

-- SELECT joined column + attribute from a Left Outer
SELECT AT_BUSINESS_UNIT_MATNR, BUSINESS_UNIT, SUM(VVREV) FROM "_SYS_BIC"."copa-poc/AN_COPA/olap"
GROUP BY AT_BUSINESS_UNIT_MATNR, BUSINESS_UNIT

 

Join is executed for additional attribute on attribute view

Capture3.JPG

 

-- SELECT joined column + attribute from a Referential
SELECT MATNR, MATKL, SUM(VVREV) FROM "_SYS_BIC"."copa-poc/AN_COPA/olap"
GROUP BY MATNR, MATKL

 

Two joins are executed for each column from attribute view

Capture4.JPG

 

So from here, it's pretty clear that the avoidance of joins when only the key attribute column is selected is achieved by user the left outer join. This looks to be a huge performance consideration within HANA as compared to typical DW architectures that rely on surrogate keys.

 

Thanks,

Justin


Viewing all articles
Browse latest Browse all 8968

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>