Real Time Information Director User Documentation
    RTID Metadata Language 
Hewlett-Packard Company  55  529618-002   
master data, for example a data table representing a customer, a product, or a 
factory. 
•  Parent-child affinity. A new record is assigned the same partition ID as the parent 
record in the document. This strategy helps to cluster the data, at least when the 
data is first inserted. (Note that the relationship between this child record and the 
parent record might be temporary and non-exclusive. For example, a single 
account might be associated with multiple customers, with different partition IDs, 
and customers might, over time, be added or dropped from the account.) 
•  Key affinity. A new record is assigned the same partition ID used by a related 
record in another artificially partitioned table. This strategy insures that the data 
is clustered in a way that is optimal for the future.  You can use key affinity only 
if the new record is permanently and exclusively associated with the related 
record: that is, if you would never need to associate the record with a different 
record in the same table, using a different partition ID. (An example is a debit or 
credit to an account.) There are two types of key-affinity strategies: system key 
and natural key. System-key affinity is used if the related table has an artificial 
key. Natural-key affinity is used if the related table has a natural key. 
•  Hashing. The partition ID is hashed from the natural key. 
Partitioning with Natural Keys 
In the case of a natural key, the partition ID is either hashed from the key or assigned 
according to natural key affinity. To provide for this kind of partitioning, you 
1.  Modify the tables you want to partition. In each table to be partitioned, define a 
column to contain the partition ID, and make that column the first column of the 
primary key of the table. The partition ID is a short, a 16-bit binary value. Make 
the natural key value the other column of the primary key. 
2.  Create a PartitionParameters object, specifying the starting partition number and 
the number of partitions. 
3.  Create an enrichment, using the PartitionedKey enrichment class. Specify the 
partitioning parameters, the database column that will contain the Partition ID, 
and the partitioning strategy (HashPartitionID or NaturalKeyAffinity). 
4.  Create an EnrichedRecord object, specifying the table name and the enrichment 
you created in step 3. 
The constructors for these classes are described in the RTID Javadocs. For examples, see 
“Partitioning Tables,” later in this section. 










