Partitioning Local Tables
Create partitions for your local table to break your data down into smaller tables, and better manage tables with a large volume of data.
Prerequisites
-
To access SAP Datasphere, you must have Data Warehouse General (-R------) -
-
To create, update, or schedule partitions, you must have a scoped role that grants you access to a space with the following privileges: Data Warehouse Data Integration (--UE----) – The DW Integrator role template, for example, grants this privilege. Note that with this privilege, you will be able to create partitions both on empty tables and on tables that already contain data.
-
To create, see and monitor existing partitions, you must have a scoped role that grants you access to a space with the following privileges: Data Warehouse Data Builder (-RU---) – The DW Modeler role template, for example, grants this privilege. Note that with this privilege, you will be able to create partition on tables that don't have data only. To create partitions on tables that already contain data, you must add the Data Warehouse Data Integration permission.
For more information, see Privileges and Permissions and Standard Roles Delivered with SAP Datasphere.
To create partitions for local tables (file) stored in a file space (with SAP HANA Data Lake Files storage), see Creating a Local Table (File).
Introduction to Partitioning
-
Range: You select one column of your table that will serve for the partitioning. The table will then be split into several partitions according to the different ranges you have defined. For example, you have set the column Year as the column to serve the partition. This column contains data from the year 2000 to the year 2025. You have defined the partition ranges as follows:
-
Range 1: From the year 2000 to the year 2005
-
Range 2: From the year 2006 to the year 2010
-
Range 3: From the year 2011 to the Year 2015
-
Range 4: From the year 2016 to the Year 2020
-
Range 5: From the year 2021 to the Year 2025
You will get 5 partitions, but they can contain different amounts of data.
-
-
Hash: You select one or more columns of your table that will serve for the partitioning. The table will then be split into the number of partitions you have defined. In our example above, if you have set 15 partitions on the Year column, you will have 15 partitions that will contain the same amount of data.
-
Dynamic Range: You select one column of your table that will serve for the partitioning. The table will then be split into several partitions based on the intervals you have defined. The OTHERS partition stores values outside the defined intervals. With the dynamic interval partitioning, the OTHERS partition will be automatically split using the specified interval when it reaches a predefined size limit, creating new partitions following a consistent range pattern. For example, if you define an interval of 10, the following ranges will be created : 100–110, 110–120, 120–130. Each new partition that will be created will increase by 10 (130-140, 140-150, etc). This ensures efficient data distribution, maintains optimal query performance, and adapts seamlessly to increasing data volumes.
For more information, see Dynamic Range Partitioning
Partitioning Columns
-
If the table contains key columns, only key columns can be selected.
-
If the table does not contain key columns, all columns that are not nullable and with compatible data types can be selected. In addition, for the dynamic partition, the column must be a consistently incrementing numerical sequence such as a timestamp or an integer.
-
Only columns with the following data types can be selected:
-
Range and Hash Partitioning:
-
String
-
Integer, Integer 64, Decimal, hana.SMALLINT, hana.TINYINT
-
Date, DateTime, Timestamp
-
Binary
-
-
Dynamic Partitioning:
-
Date
-
Seconddate
-
Timestamp
-
Tinyint
-
Smallint
-
Int
-
Bigint
-
-
For more information, see Partitioning Limits in the SAP HANA Cloud, SAP HANA Database documentation.
Procedure
-
Go to the Data Builder
-
Create your local table (for more information, see Creating a Local Table)
-
Go to the Partitions tab.
-
Click Define Partitions, select the Partition Type and enter its definition:
-
Range Partition:
Property Description Column
Select the column from which the partition will be defined.
Partitions
Create the number of desired partitions by entering a range for each of them. Note that ranges can't overlap.
-
Hash partition:
Property Description Columns
Select one or several columns from which the partition will be defined.
Number of Hash Partitions
Create the number of desired partitions.
-
Dynamic Range:
Property
Description
Column
Select one column from which the partition will be defined.
Dynamic Range Interval
Define the interval that determines how the new partitions will be created. It can be:-
A time-based interval using data types such as DATE, TIMESTAMP, SECONDDATE. In this case, an interval unit (YEAR or MONTH) is also required.
-
A numeric interval using data types such as INT, BIGINT, Smallint, tinyint. The interval defines the distance between partition boundaries, so newly created partitions follow a consistent pattern.
-
-
-
Save the partition definition and deploy the table.
Deployment and Partitioning
Case 1: Your Table Does Not Contain Data
If your table does not contain data and was not deployed before you created the partition, the deployment will run immediately. You can still change or delete partitions until you add data to your table.
Case 2: Your Table Contains Data
Partitioning large tables can be time- and resource-consuming. To ensure efficient deployment, the partitioning process must not block the deployment of the table or its dependent objects. Therefore, partitioning will be run as a separate task after the table has been successfully deployed.
-
Automatically After Deployment: Once the deployment is complete, the partition creation task will start automatically.
-
Automatically at a Scheduled Time: You define a timestamp when the partitions must be created. Once deployment is complete, the partition creation task will start automatically at the scheduled timestamp.
-
Manually at Later Time : Once the deployment is complete, you will be able to create the partitions when you want.
You can monitor your partitions in the Local Tables monitor. For more information, see Monitoring Your Partitions.