Ingest operations in a partitioned database environment

You can use the ingest utility to move data into a partitioned database environment.

INGEST commands running on a partitioned database use one or more flushers for each partition, as specified by the num_flushers_per_partition configuration parameter. The default is as follows:
max(1, ((number of logical CPUs)/2)/(number of partitions) )
You can also set this parameter to 0, meaning one flusher for all partitions.

Each flusher connects directly to the partition to which it will send data. In order for the connection to succeed, all the Db2® server partitions must use the same port number to receive client connections.

If the target table is a type that has a distribution key, the ingest utility determines the partition that each record belongs to as follows:
  1. Determine whether every distribution key has exactly one corresponding field or constant value. This will be true if:
    • For an INSERT statement, the column list contains every distribution key and for each distribution key, the corresponding item in the VALUES list is a field name or a constant.
    • For an UPDATE or DELETE statement, the WHERE predicate is of the form
      (dist-key-col1 = value1) AND (dist-key-col2 = value2) AND ... 
      (dist-key-coln = valuen) [AND any-other-conditions]
      where dist-keycol1 to dist-key-coln are all the distribution keys and each value is a field name or a constant.
    • For a MERGE statement, the search condition is of the form shown previously for UPDATE and DELETE.
  2. If every distribution key has exactly one corresponding field or constant value, the ingest utility uses the distribution key to determine the partition number and then routes the record to one of that partition's flushers.
    Note: In the following cases, the ingest utility does not determine the record's partition. If there is more than 1 flusher, the ingest utility routes the record to a flusher chosen at random:
    • The target table is a type that has no distribution key.
    • The column list (INSERT) or predicate (UPDATE, MERGE, DELETE) does not specify all distribution keys. In the following example, key columns 2-8 are missing:
      UPDATE my_table SET data = $data     
          WHERE (key1 = $key1) AND (key9 = $key9); 
    • A distribution key corresponds to more than one field or value, as in the following example:
      UPDATE my_table SET data = $data     
          WHERE key1 = $key11 OR key1 = $key12; 
    • A distribution key corresponds to an expression, as in the following example
      INGEST FROM FILE ...     
          INSERT INTO my_table(dist_key, col1, col2)        
              VALUES($field1 + $field2, $col1, $col2); 
    • A distribution key column has type DB2SECURITYLABEL.
    • A field that corresponds to a distribution key has a numeric type, but the distribution key column type is a different numeric type or has a different precision or scale.