ORACLE和DB2都引入了partition的概念.可是區別仍是至關大的.數據庫
ORACLE的分區是表的分區,每張表能夠按某一列的值將數據進行組織,索引,和查詢.每一個分區能夠放在不一樣的表空間裏,各分區能夠單獨操做.oracle
DB2的分區是數據庫分區,它的每一個分區能夠視爲一個獨立的數據庫,有自已的後臺進程,內存結構和存儲磁盤,分區的數據庫的每一個分區上的表空間是一致的,也就是說,一個分區數據庫中的表,就好像把數據分區放在不一樣的數據庫中同樣.在分區數據庫中建表,如不指定分區鍵,系統認爲表的第一個字段是分區鍵.url
在最新未公開發布的DB2 V9.1中,也支持了表分區的概念,其用法與ORACLE的用法相似.spa
ORACLE的分區表建表語句:orm
CREATE TABLE product_informationblog
( product_id NUMBER(6)索引
, product_name VARCHAR2(50)進程
, product_description VARCHAR2(2000)ip
, category_id NUMBER(2)內存
, weight_class NUMBER(1)
, warranty_period INTERVAL YEAR TO MONTH
, supplier_id NUMBER(6)
, product_status VARCHAR2(20)
, list_price NUMBER(8,2)
, min_price NUMBER(8,2)
, catalog_url VARCHAR2(50)
, CONSTRAINT product_status_lov
CHECK (product_status in (’orderable’
,’planned’
,’under development’
,’obsolete’)
) )
PARTITION BY HASH (product_id)
STORE IN (prod_ts1, prod_ts2, prod_ts3, prod_ts4, prod_ts5);
DB2的分區數據庫的建表語句:
CREATE TABLE DEPT_INFOMATION
(OP_TIME VARCHAR(140),
DEPT_NO VARCHAR(140),
DEPT_NAME VARCHAR(140),
UP_DEPT_NO VARCHAR(140),
UP_DEPT_NAME VARCHAR(140),
DEPT_FUNC_DEPICT VARCHAR(140),
FOUND_TIME VARCHAR(140),
DIS_FOUND_TIME VARCHAR(140),
COUNTRY VARCHAR(140),
EMPL_COUNT VARCHAR(140)
)
DATA CAPTURE NONE
IN TBS_ODS
INDEX IN TBS_IDX
PARTITIONING KEY
(DEPT_NO
) USING HASHING
NOT LOGGED INITIALLY;
DB2 V9.1的建分區表的語句:
CREATE TABLE sales (year INT, month INT)
IN tbsp1, tbsp2, tbsp3, tbsp4, tbsp5, tbsp6, tbsp7, tbsp8
PARTITION BY RANGE(year, month)
(STARTING FROM (2001, 1) ENDING (2001,3) IN tbsp1,
ENDING (2001,6) IN tbsp2, ENDING (2001,9)
IN tbsp3, ENDING (2001,12) IN tbsp4,
ENDING (2002,3) IN tbsp5, ENDING (2002,6)
IN tbsp6, ENDING (2002,9) IN tbsp7,
ENDING (2002,12) IN tbsp8)