Skip to Content
avatar image
Former Member

Hash Partitioning

I was going through the below discussion and understood that partition assignment happens using modulo function.

I am using cds to create my entity and have the partition defined based on an integer column. But I could see the distribution of the data is not as per the above discussion. I am curious to understand the hash generation out of the integer data. Following is the cds entity and the insert statements to test the distibution.

Type KeyT {
 UniqueName: UniqueNameT;
 PartitionNumber: Integer;
 SystemId: SystemIdT;
Entity CompanyCodeE {
key CompanyCodeKey : KeyT;
BaseFields : BaseFieldsT;
FlexFields : FlexFieldsT;
SAP: SAPCompanyCodeT;
SAPProcurementUnitAssociation : Association[1] to          ProcurementUnitE on SAPProcurementUnitAssociation.ProcurementUnitKey.UniqueName = SAP.ProcurementUnitKey.UniqueName                    and SAPProcurementUnitAssociation.ProcurementUnitKey.PartitionNumber = SAP.ProcurementUnitKey.PartitionNumber;
}technical configuration {
 partition by hash (CompanyCodeKey.PartitionNumber) partitions 3000;
INSERT INTO "MDS_SCHEMA_BG_DEPLOY".""("CompanyCodeKey.UniqueName", "CompanyCodeKey.PartitionNumber", "CompanyCodeKey.SystemId") VALUES('SAT',2940,'SYS');

I have inserted 3000 rows with partition number ranging from 0-2999. I had an assumption that the data will be distributed to the partitions based on the modulo function and each partition will have 1 record. But when I inserted the data it's 0,1,2 or 3 rows in partitions. Now to correctly understand I need to know a bit on the hash function it uses.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers