All Forums Database
Peeps 1 post Joined 05/16
25 May 2016
Partition by Range_N

Hi all,

I have a question about partition of a table.


I have a table with a unique primary index column1 of datatype char(2).

I want to define a RANGE_N - partition on column1 using the hash-function HASHROW as follow:


partition by ( RANGE_N((HASHBUCKET(HASHROW(column1 ))) MOD  x  BETWEEN 0  AND (x-1)  EACH 1  ) 


My issue is that I need to find an appropriate integer x for which there are not overlappings of the values HASHBUCKET(HASHROW(column1)).

That is, for every two values of the field column1, I need to ensure that these values do not belong to the same partition. 


Is there a method to find an integer x with this property?



dnoeth 4628 posts Joined 11/04
26 May 2016

You can't be sure that no hashes overlap but a high number of x (e.g. 65535) will reduce the risk.
If it's Latin only you could also do two-levels using character partitioning for each character:

'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
AND 'Z',

Btw, if you got a UPI on a CHAR(2) the possible number of rows is probably way to small for partitioning.


ToddAWalter 316 posts Joined 10/11
26 May 2016

What is the goal for partitioning this column? With the UPI, any query WHERE column1='xx' will already be a single AMP, single row query.

You must sign in to leave a comment.