Scalable Database Server, HiRDB Version 8 Description
The process by which a single table is split amongst multiple user RDAREAs or user LOB RDAREAs is called table row partitioning. A table that is partitioned by this method is called a row-partitioned table. When you row-partition a table, you can use user RDAREAs or user LOB RDAREAs as the unit for storing the table's data, reorganizing the table, and making backups.
For example, you could row-partition a table to match the different types of UAPs (job types) that will access the table and then store the sections appropriate to the various UAP types in different RDAREAs. Then, when it becomes necessary to make a backup, you need stop only the UAPs that are accessing the RDAREA that is to be backed up, which facilitates overall system operation.
In the case of a HiRDB/Parallel Server, it is possible to access concurrently a table in user RDAREAs or user LOB RDAREAs under multiple back-end servers, resulting in high-speed table access and better load distribution.
Figure 3-8 shows table row partitioning.
Figure 3-8 Table row partitioning
There are two methods for row-partitioning a table:
Key range partitioning is when ranges of values in a specified column are used as the conditions for row-partitioning the table. The specific column that provides the conditions for row partitioning is called the partitioning key. Key range partitioning is used when the actual RDAREAs in which table data is stored must be known. There are two ways to specify this type of row partitioning:
Comparison operators are used to specify conditions for selecting the data to be stored in specific RDAREAs. Only one range of values, as specified by a storage condition, can be set in each RDAREA. Figure 3-9 shows an example of key range partitioning with a storage condition specified.
Figure 3-9 Key range partitioning: Example of storage condition specification
CREATE TABLE STOCK (PCODE CHAR(4) NOT NULL,PNAME NCHAR(8), COLOR NCHAR(1),PRICE INTEGER,SQUANTITY INTEGER )IN ((RDAREA01)PCODE<='353M',(RDAREA02));
Boundary values for the data to be stored in each RDAREA are specified with literals in ascending order. Multiple ranges delimited by boundary values can be specified for each RDAREA. Figure 3-10 shows an example of key range partitioning with boundary values specified.
Figure 3-10 Key range partitioning: Example of boundary value specification
CREATE TABLE STOCK (PCODE CHAR(4) NOT NULL,PNAME NCHAR(8), COLOR NCHAR(1),PRICE INTEGER,SQUANTITY INTEGER )PARTITIONED BY PCODE IN ((RDAREA01)'302S',(RDAREA02)'591S',(RDAREA01));
Hash partitioning is when a table is row-partitioned by using a hash function to store evenly among the storage RDAREAs the values contained in the columns that make up the table. The specific column that provides the conditions for row-partitioning is called the partitioning key. Hash partitioning is used when it is necessary to store the same amount of table data is each of the RDAREAs. Table 3-4 provides an overview of the two types of hash partitioning.
Table 3-4 Types of hash partitioning
Hash partitioning type | Explanation |
---|---|
Flexible hash partitioning | The RDAREAs in which the table is stored cannot be determined. Therefore, a search process must check all back-end servers that may contain parts of the table. |
FIX hash partitioning | HiRDB keeps track of the RDAREAs in which the table is stored. Consequently, a search process has to check only the back-end servers that are expected to contain the table's the data. |
Figure 3-11 shows an example of hash partitioning.
Figure 3-11 Example of hash partitioning
CREATE TABLE STOCK (PCODE CHAR(4) NOT NULL,PNAME NCHAR(8), COLOR NCHAR(1),PRICE INTEGER,SQUANTITY INTEGER ) [FIX]* HASH HASH6 BY PCODE IN (RDAREA01,RDAREA02);
The RDAREAs into which a row-partitioned table is stored should be allocated for different disks. If they are allocated on the same disk, contention for access to these RDAREAs can occur, resulting in decreased performance.
The concepts of row partitioning among servers and row partitioning within a server apply to a HiRDB/Parallel Server. Row-partitioning among servers is the mode in which a table is row-partitioned over multiple back-end servers. Row-partitioning within a server is the mode in which a table is row-partitioned within a single back-end server. In the case of a HiRDB/Single Server, row-partitioning is always within the server.
Figure 3-12 shows an example of table row partitioning for a HiRDB/Single Server, and Figure 3-13 shows an example of table row partitioning for a HiRDB/Parallel Server.
Figure 3-12 Example of table row partitioning: HiRDB/Single Server
Figure 3-13 Example of table row partitioning: HiRDB/Parallel Server
To row-partition a table, the elements listed below must be specified in the CREATE TABLE definition SQL:
For details about the row-partitioning design considerations for improving processing performance, see the HiRDB Version 8 Installation and Design Guide.
When new RDAREAs are added to accommodate an increase in the volume of data in a hash-partitioned table (increase in the number of table partitions), there may be significant differences in the amount of data stored in the existing RDAREAs and in the new RDAREAs. The hash facility for hash row partitioning corrects this sort of imbalance in the amount of data in RDAREAs as a result of increasing the number of table partitions. Figure 3-14 illustrates the hash facility for hash row partitioning. This facility can be applied to both FIX hashing and flexible hashing.
For details about the hash facility for hash row partitioning, see the HiRDB Version 8 System Operation Guide.
Figure 3-14 Hash facility for hash row partitioning
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.