Various Table Partitioning in SAP HANA

22
Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 1 For simplicity, here I have discussed only Single-Level Partitioning with all the three partitioning specifications - Hash, Range and Round-robin. Also I have shown the steps for re-distribution of all the partitions to different hosts in a distributed SAP HANA database. Partitioning a Non-Partitioned Table ………………………………………………………………………………………… 2 Round-Robin Partitioning ……………………………………………………………………………………………………………. 2 Hash Partitioning ……………………………………………………………………………………………….. 8 Range Partitioning ……………………………………………………………………………………………… 14 Changing a Partitioned Table into a Non-Partitioned Table …………………………. 18

description

Table partitioning is a data organization scheme in which table data is divided across multiple storage objects called data partitions. In SAP HANA database, it is possible to split column-store tables horizontally into disjunctive sub-tables or partitions. The SAP HANA database supports several redistribution operations that use complex algorithms to evaluate the current distribution and determine a better distribution depending on the situation. Partitioning is typically used in distributed systems, but it may also be beneficial for single-host systems. Partitioning is transparent for SQL queries and data manipulation language statements. In a distributed SAP HANA system, tables are assigned to an index server on a particular host at their time of creation, but this assignment can be changed. In certain situations, it is even necessary. In SAP HANA side-by-side implementation, SLT will stop replication when SAP HANA table reaches 2 billion records as a non-partitioned table cannot store more than 2 billion rows. Advantages of partitioning: + Load balancing in a distributed system + Overcoming the size limitation of column-store tables + Parallelization + Partition pruning + Improved performance of the delta merge operation + Explicit partition handling SAP HANA supports: - Hash Partitioning - Range Partitioning - Round-robin Partitioning

Transcript of Various Table Partitioning in SAP HANA

Page 1: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 1

For simplicity, here I have discussed only Single-Level Partitioning with all the three partitioning specifications - Hash, Range and Round-robin. Also I have shown the steps for re-distribution of all the partitions to different hosts in a distributed SAP HANA database.

Partitioning a Non-Partitioned Table ………………………………………………………………………………………… 2

Round-Robin Partitioning ……………………………………………………………………………………………………………. 2

Hash Partitioning ……………………………………………………………………………………………….. 8 Range Partitioning ……………………………………………………………………………………………… 14

Changing a Partitioned Table into a Non-Partitioned Table …………………………. 18

Page 2: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 2

Partitioning a Non-Partitioned Table

Round-Robin Partitioning – Table

Page 3: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 3

Page 4: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 4

Before doing a redistribution operation, it is always better to save the current configuration.

Page 5: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 5

Page 6: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 6

Page 7: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 7

Now, Round-robin Partitioning has been completed and Partitioned Tables also distributed between two hosts.

Page 8: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 8

HASH Partitioning - Table

Page 9: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 9

Page 10: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 10

Page 11: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 11

Page 12: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 12

Page 13: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 13

Now, Hash Partitioning of AUSP table has been completed and Partitioned Tables also distributed between 4 hosts.

Page 14: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 14

Range Partitioning - Table

Page 15: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 15

Page 16: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 16

Page 17: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 17

Now, Range Partitioning of KONV table has been completed. From the results, we can easily understand that distribution of records was not proper between all the partitions. What to do then?

Page 18: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 18

Changing a Partitioned Table into a Non-Partitioned Table As per the above Range partition results, it clearly depicts that distribution was not proper as Range selections were wrong. So, to rectify the same we have to follow the below process –

1) Changing Partitioned Table into a Non-Partitioned Table 2) Then Repartition the table with proper range selection

Select the Merge Partitions option.

Page 19: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 19

Once again, trying to do Range Partition now for better record distributions.

Page 20: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 20

Page 21: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 21

Page 22: Various Table Partitioning in SAP HANA

Various Table Partitioning in SAP HANA Prepared by Debajit Banerjee

http://debajitb.wix.com/debajitbanerjee | http://debajitb.wix.com/debajitbanerjee/apps/blog 22

===== End of Document ======