Table is created using:
CREATE TABLE BK
(CUSTOMER VARCHAR(80),
REGION CHAR(5),
PURCHASEDATE DATE,
PURCHASEYEARMONTH INTEGER)
DISTRIBUTE BY HASH (REGION)
ORGANIZE BY DIMENSIONS (PURCHASEYEARMONTH)
PARTITION BY RANGE("PURCHASEDATE")
(PART "PD022009" STARTING('2009-02-01') ENDING('2009-02-28') IN "PD022009",
PART "PD032009" STARTING('2009-03-01') ENDING('2009-03-31') IN "PD032009");
To check if a table was created using "DISTRIBUTE BY HASH" and "ORGANIZE BY DIMENSIONS":
$ db2 "select PARTITION_MODE, CLUSTERED from syscat.tables where TABNAME = 'BK'"
PARTITION_MODE CLUSTERED
-------------- ---------
H Y
To get a list of columns used with "DISTRIBUTE BY HASH":
$ db2 "select colname from syscat.columns where tabname = 'BK' and partkeyseq != 0"
COLNAME
--------------------------------------------------------------------------------------------------------------------------------
REGION
To get a list of columns used with "ORGANIZE BY DIMENSIONS":
$ db2 "select colname from syscat.coluse where tabname = 'BK'"
COLNAME
--------------------------------------------------------------------------------------------------------------------------------
PURCHASEYEARMONTH
To get a list of table partitions and tablespaces they're in:
$ db2 "select substr(datapartitionname,1,15) as TABLEPART,tbspaceid from syscat.datapartitions where tabname = 'BK'"
TABLEPART TBSPACEID
--------------- -----------
PD022009 10
PD032009 11
Is there a column in the catalog that will tell me explicitly whether a table is range partitioned or not and column used with "PARTITION BY RANGE"?