Skip to Content
Technical Articles

SQL & CDS Table Partitioning the graphical way

As a fellow HANA Model developer the concept of  partitioning in HANA modelling really intrigued me, however in many of the blogs I found it to be very informative but I wanted to see something more like from the modelling stand point how its helps and if this can be achieved though the graphical way.

In this blog I will discuss how we can partition  SQL table by Partitioning it graphically through HANA Studio and also how we can partition a CDS table from the Web IDE.

Prerequisites : The developer has concept of Table partitioning and why it is needed

If not already aware please go through the link .Still I would like to give a brief  overview.

In SAP HANA a non partitioned table can hold up to a maximum of 2 billion records but after that we can keep more records in the same table by partitioning the table. This being a need for storing huge data sets is not the only reason of doing partition as we can understand a table which has around 2 Billion of record count can have indicative performance impacts on the upper model as full table scan will be costly. Thus partitioning helps in reliving load on the model performance as well.

There are basically 3 types of partitioning for Single level:

  1. Hash
  2. Range
  3. Round Robin

There is also multi level partitioning too .

SQL table graphical partitioning:

 

First select the schema where the non partitioned table resides on. Then right click and select from the options show table distribution.

In the next screen select the non-partitioned table. Then right click on the table and select partition table.

In this screen you will have option to select the type of partition and the number of partitions. The number of partitions can be decided on the basis of number of hosts in the system in our case it is single host system.so its one ,we can manually set the number of parameters for HASH partition.

In%20case%20number%20of%20partition%20is%20decided%20on%20number%20of%20host

In case number of partition is decided on number of host

In%20case%20we%20want%20to%20specify%20the%20partition%20number

In case we want to specify the partition number

Note: the partition strategies will be from the drop down depending on the table structure .i.e. if the table supports that’s strategy or not. For example HASH and Range partition Key columns need to be in partitioning column but in case of Round robin the table should not have a Key column[So round robin is not supported by our table]. Below screen shots have the  screen shot for how the column selection happens.

For%20HASH%20Partition%20a%20combination%20of%20columns%20can%20be%20taken

For HASH Partition a combination of columns can be taken

  For%20Range%20Partition%20we%20can%20select%20the%20column%20for%20which%20the%20range%20is%20to%20operate

For Range Partition we can select the column for which the range is to operate

 

Note: for range partition there can be ranges given and also single value is supported. Ranges are like  start value(>=) and End Value (<).

We can check if our queries are hitting the correct partition. Like the table that we now partitioned on basis of Range partition w.r.to RYEAR. We can see for the proper where clause its going to the correct partition id in explain plan.

From%20this%20screen%20shot%20we%20can%20see%20the%20total%20partitions%20the%20table%20is%20distributed%20along%20side%20the%20partition%20id

From this screen shot we can see the total partitions the table is distributed along side the partition id

The%20select%20is%20hitting%20the%20correct%20partition

The select is hitting the correct partition

CDS Table partitioning:

Similar to the way we partitioned the catalog SQL table above we can partition a CDS table.Below would be the steps.

Double click on the CDS table and open the GUI,

Double click on the table name and go to the partition tab as given below.

Check the box below and  as before please select the type of partition you want to do.

 

So in the above blog we have learnt how to Partition SQL and CDS code bases tables in a Graphical manner,also we could see how SQL queries go to access the partitions sufficing the proper conditions in the where clause .

Hope this will be helpful !! Please share your feedback and suggestions .

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.