Data partitioning and collecting in Datastage

Partitioning mechanism divides a portion of data into smaller segments, which is then processed independently by each node in parallel. It helps make a benefit of parallel architectures like SMP, MPP, Grid computing and Clusters.

Collecting is the opposite of partitioning and can be defined as a process of bringing back data partitions into a single sequential stream (one data partition).

Data partitioning methods

Datastage supports a few types of Data partitioning methods which can be implemented in parallel stages:

  • Auto
  • - default. Datastage Enterprise Edition decides between using Same or Round Robin partitioning. Typically Same partitioning is used between two parallel stages and round robin is used between a sequential and an EE stage.
  • Same
  • - existing partitioning remains unchanged. No data is moved between nodes.
  • Round robin
  • - rows are alternated evenly accross partitions. This partitioning method guarantees an exact load balance (the same number of rows processed) between nodes and is very fast.
  • Hash
  • - rows with same key column (or multiple columns) go to the same partition. Hash is very often used and sometimes improves performance, however it is important to have in mind that hash partitioning does not guarantee load balance and misuse may lead to skew data and poor performance.
  • Entire
  • - all rows from a dataset are distributed to each partition. Duplicated rows are stored and the data volume is significantly increased.
  • Random
  • - rows are randomly distributed accross partitions
  • Range
  • - an expensive refinement to hash partitioning. It is imilar to hash but partition mapping is user-determined and partitions are ordered. Rows are distributed according to the values in one or more key fields, using a range map (the 'Write Range Map' stage needs to be used to create it). Range partitioning requires processing the data twice which makes it hard to find a reason for using it.
  • Modulus
  • - data is partitioned on one specified numeric field by calculating modulus against number of partitions. Not used very often.

    Data collecting methods

    A collector combines partitions into a single sequential stream.
    Datastage EE supports the following collecting algorithms:

  • Auto
  • - the default algorithm reads rows from a partition as soon as they are ready. This may lead to producing different row orders in different runs with identical data. The execution is non-deterministic.
  • Round Robin
  • - picks rows from input partition patiently, for instance: first row from partition 0, next from partition 1, even if other partitions can produce rows faster than partition 1.
  • Ordered
  • - reads all rows from first partition, then second partition, then third and so on.
  • Sort Merge
  • - produces a globally sorted sequential stream from within partition sorted rows. Sort Merge produces a non-deterministic on un-keyed columns sorted sequential stream using the following algorithm: always pick the partition that produces the row with the smallest key value.


    Comments

    2010-02-19 07:50:54 by Nisha:
    I need more information about the partition methods practically.
    2010-11-24 05:28:56 by chinna:
    I need more information about the partition methods in practice.
    2011-03-26 16:28:36 by sandy ph:
    If there is a huge amount of data and - want to optimize capabilities of SMP processing in all nodes, what are the best combination of partitioning methods between parallel stages?
    Rgds,
    Sandy