Skip to Content
0
Former Member
Nov 10, 2015 at 12:02 AM

Partition Pruning in HANA

452 Views

I am fairly new to analyzing visual plans in HANA, but I am experiencing something I cannot quite explain. We have a small fact table of about 3 billion rows. We have range partitioned this table by what I will call Fiscal Week (SALES_DATE_FISCAL_WEEK), which is a year and week concatenated (i.e '201441', etc.), and grouped the partitioning so that 1 Fiscal Month is contained within a partition (4 or 5 fiscal weeks). We have this table spread across 3 nodes.

When I visualize the explain against this table for one fiscal month:

SELECT *

FROM FACT TABLE

WHERE SALES_DATE_FISCAL_WEEK BETWEEN '201449' AND '201452'

AND LOCATION = '0171'

I see a search on one single partition, partition 85, as I would expect.

When I visualize this plan, I see a search on all partitions:

SELECT *

FROM FACT TABLE

WHERE SALES_DATE BETWEEN '20150104' AND '20150131'

AND LOCATION = '0171'

Now the confusing part. We have a complex model created that I won't detail here, but this is the gist of what we are doing. We are computing 3 dates from our Time dimension, a current month, Last year current month, and Last Last year current month, i.e. TY, LY, and LLY. This is being supplied as SALES_DATE BETWEEN X AND Y. I see this in each of the between predicates, for each of the cases above, TY, LY, and LLY. For example:

Summary: SALES_DATE BETWEEN '20150104' AND '20150131'

What I see however, is ONLY 3 PARTITIONS INVOLVED. The predicate is NOT on Partitioning Column, but on the SALES_DATE. It appears I get Partition Pruning, but we are not using the column I would have thought I needed to be involved based on the results above.

Is this the result of some transitive property in HANA? Am I missing something obvious? In the actual Join Operator for one of these 3 joins, I see 4 dimension tables being joined to the central fact table, but I cannot see how to view the sql from this join. At some point I assume the the Calendar Table is being joined to the fact table on this SALES_DATE.

Any help would be appreciated.