CREATE TABLE my_orders ( order_num SERIAL(1001), order_date DATE, customer_num INT, ship_instruct CHAR(40), backlog CHAR(1), po_num CHAR(10), ship_date DATE, ship_weight DECIMAL(8,2), ship_charge MONEY(6), paid_date DATE, PRIMARY KEY (order_num), FOREIGN KEY (customer_num) REFERENCES customer(customer_num)) FRAGMENT BY ROUND ROBIN IN dbspace1, dbspace2, dbspace3
或者,您也可以决定使用基于表达式的分段存储来创建表。假定 my_orders 表有 30000 行,并且您想对三个存储在 dbspace1、dbspace2 和 dbspace3 中的分段均匀地分布行。以下语句显示了如何使用 order_num 列来定义基于表达式的分段存储策略:
CREATE TABLE my_orders (order_num SERIAL, ...) FRAGMENT BY EXPRESSION order_num < 10000 IN dbspace1, order_num >= 10000 and order_num < 20000 IN dbspace2, order_num >= 20000 IN dbspace3