Real Time Information Director User Documentation
RTID Metadata Language
Hewlett-Packard Company 56 529618-002
Partitioning with Artificial Keys
In the case of an artificial key, the partition ID is assigned according to any of the
following strategies (defined earlier):
• Round-robin partitioning
• Parent-child affinity
• System key affinity
Given the partition ID, the Director assigns an artificial key (or system key). The
Director divides the key space by partition, so the partition ID can be deduced from the
system key.
To provide for this kind of partitioning, you
1. Modify the KEYS table in your database to include parameters like the starting
partition number, the number of partitions, and the range of keys for each kind of
data. For each kind of data to be partitioned, you choose a keyspace name; for
example, to partition the PERSON table, you might reasonably choose the name
PERSONID.
Here is a reformatted listing of the contents of the KEYS table for a version of the
EHR example that uses partitioning for PERSONID keys. The table defines
keyspaces for three kinds of data: audits, encounters, and persons. NEXTKEY is
the next key available for retrieval by a KeyDispenser class--not the next key
available for assignment to a record, but the first key in the next block available
for a KeyDispenser class to claim. (The block size used for each keyspace has
implications for performance and is a parameter that you specify in your
metadata.) MAXKEY is the maximum number of keys available for assignment
within the partition, PARTITIONID is the number of the partition to which this
row in the KEYS table applies, and MAX_PARTITIONID is the maximum
number of partitions for the keyspace.
NAME NEXTKEY MAXKEY PARTITIONID MAX_PARTITIONID
AUDITID 1120 99999999999999999 0 1
ENCOUNTERID 30 99999999999999999 0 1
PERSONID 200 999999 0 4
PERSONID 1000100 1999999 1 4
PERSONID 2000100 2999999 2 4
PERSONID 3000100 3999999 3 4
2. 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. Define a column to contain the artificial key, and make
that column the other column in the primary key of the table. The partition ID is
a short, a 16-bit binary value. The artificial key is a long, 64-bit binary value.