VALUE2PROC

Purpose

This function returns the corresponding database node for a certain value. This mapping corresponds with the data distribution that would be achieved if you do a DISTRIBUTE BY that value.

Syntax

value2proc::=

Usage Notes

  • This function can be used to understand the actual data distribution across the cluster nodes which can be achieved with the ALTER TABLE (Distribution/Partitioning).
  • The return value is an integer between 0 and (NPROC - 1).
  • In context to this functions, also refer to functions IPROC and NPROC for more information.

Example

SELECT IPROC(),
       c1, VALUE2PROC(c1) V2P_1,
       c2, VALUE2PROC(c2) V2P_2 FROM t;
Result
IPROC C1 V2P_1 C2 V2P_2
0 1 3 abc 3
1 2 2 abcd 0
2 3 1 abcde 1
3 4 0 abcdef 3
0 5 3 abcdefg 0
1 6 2 abcdefgh 2
2 7 2 abcdefghi 1
3 8 1 abcdefghij 1