Home | Previous Page | Next Page   Managing Databases > Table Fragmentation Strategies > Distribution Schemes for Table Fragmentation >

Expression-Based Distribution Scheme

To specify an expression-based distribution scheme, use the FRAGMENT BY EXPRESSION clause of the CREATE TABLE or CREATE INDEX statement. The following example includes a FRAGMENT BY EXPRESSION clause to create a fragmented table with an expression-based distribution scheme:

CREATE TABLE accounts (id_num INT, name char(15)) 
FRAGMENT BY EXPRESSION
id_num <= 100 IN dbspace_1,
id_num <100 AND id_num <= 200 IN dbspace_2,
id_num > 200 IN dbspace_3

When you use the FRAGMENT BY EXPRESSION clause of the CREATE TABLE statement to create a fragmented table, you must supply one condition for each fragment of the table that you are creating.

You can define range rules or arbitrary rules that indicate to the database server how rows are to be distributed to fragments. The following sections describe the different types of expression-based distribution schemes.

Range Rule

A range rule uses SQL relational and logical operators to define the boundaries of each fragment in a table. A range rule can contain the following restricted set of operators:

A range rule can be based on a simple algebraic expression as shown in the following example. In t