Once you know CREATE TABLESPACE exists, the design questions begin: growth versus ranges, logging, when the VSAM file is defined, and how ALTER actually takes effect. DB2 universal table spaces are either PBG or PBR. Around them sit TRACKMOD, DEFINE, LOGGED / NOT LOGGED, MEMBER CLUSTER, MAXROWS, GBPCACHE, ERASE, and the world of pending definition changes and REORG-pending states.
A partition-by-growth table space is a UTS whose partitions Db2 manages as data grows. One table, segmented pages inside each partition. When an insert needs space past the current partition’s DSSIZE, Db2 adds a partition, until MAXPARTITIONS is reached. No range key is required.
123456789CREATE TABLESPACE CUSTTS IN APPDB USING STOGROUP APPSTO MAXPARTITIONS 25 SEGSIZE 32 DSSIZE 4G LOGGED DEFINE YES TRACKMOD YES;
A partition-by-range UTS stores one table with segmented organization inside parts that follow key ranges (CREATE TABLE PARTITION BY RANGE). CREATE TABLESPACE uses NUMPARTS and SEGSIZE and omits MAXPARTITIONS.
PBR can use absolute or relative page numbering (RPN). RPN supports larger, more flexible DSSIZE—including increasing DSSIZE on a single part as an immediate ALTER in documented cases. PAGENUM RELATIVE is the modern default on many subsystems (PAGESET_PAGENUM).
12345678CREATE TABLESPACE SALETS IN APPDB USING STOGROUP APPSTO NUMPARTS 12 SEGSIZE 32 DSSIZE 8G PAGENUM RELATIVE LOGGED;
| Topic | PBG | PBR |
|---|---|---|
| How parts appear | Added when data grows | Defined by key ranges |
| DDL signature | MAXPARTITIONS + SEGSIZE | NUMPARTS + SEGSIZE |
| Partitioned indexes | Not supported | Supported |
| ROTATE / ALTER PART | Not applicable | Supported (with rules) |
| Typical size | Small to medium | Large, keyed growth |
LOGGED (default) writes data changes to the recovery log. Indexes and XML/LOB auxiliary objects inherit the logging attribute of the base table space. NOT LOGGED skips that logging. You cannot specify either on table spaces in DSNDB06.
NOT LOGGED is for tables you can reload or recopy if something fails—work tables, staging, some load pipelines. After NOT LOGGED activity the space is often in a recover-pending-like situation for log-based recovery; you rely on a new image copy or a replace load. Turning logging back on with ALTER ... LOGGED is a careful operation (usually with a copy). Never make your system of record NOT LOGGED because inserts looked faster in a unit test.
TRACKMOD YES maintains modified-page bits in space maps so incremental COPY can find changed pages. TRACKMOD NO avoids that CPU and contention; incremental copy is less effective. High-insert data-sharing tables sometimes use TRACKMOD NO plus more frequent full copies.
DEFINE YES (default) defines the VSAM data set when you CREATE the space. DEFINE NO waits until the first SQL insert or LOAD that needs the data set. DEFINE NO saves empty clusters for hundreds of partitions you might not populate yet. First-touch allocation then happens on an application thread—coordinate with SMS and your error handling. DEFINE NO versus DEFINE YES can also be altered later with rules.
| Clause | Meaning |
|---|---|
| LOGGED | Default; changes go to the recovery log |
| NOT LOGGED | Skip data logging; recovery from copies/reload |
| TRACKMOD YES/NO | Track changed pages for incremental copy |
| DEFINE YES/NO | Allocate VSAM now vs at first use |
| MEMBER CLUSTER | Data-sharing insert clustering |
| MAXROWS | Cap rows per page (leave room for expansion) |
| GBPCACHE | Group buffer pool caching in data sharing |
| ERASE | Overwrite data sets when dropped |
On universal table spaces, many ALTER TABLESPACE options do not rewrite pages in place. Semantic checking happens immediately; the catalog grows a SYSIBM.SYSPENDINGDDL row; the object is AREOR (advisory REORG-pending). SQL continues. When you are ready, REORG TABLESPACE SHRLEVEL CHANGE or REFERENCE materializes BUFFERPOOL, DSSIZE, SEGSIZE, MAXPARTITIONS increases, MEMBER CLUSTER flips, convert-to-UTS, and similar pending items.
12345ALTER TABLESPACE APPDB.CUSTTS BUFFERPOOL BP8K0 MAXPARTITIONS 40; -- Object is AREOR until: -- REORG TABLESPACE APPDB.CUSTTS SHRLEVEL CHANGE
REORP (restrictive REORG-pending) is different from AREOR. REORP means you must REORG (often SHRLEVEL REFERENCE on the whole space or affected parts) before SQL can use the object normally—classic example: adding a partition in a way that leaves keys out of order, or completing some recoveries. DISPLAY DATABASE shows REORP versus AREOR. Application symptoms are unavailable-resource errors, not “it is just slow.”
Materializing pending changes clears AREOR and SYSPENDINGDDL for those objects. If both table space and index pending changes exist, REORG the table space so both apply.
PBG is a stack of notebooks: when the last notebook is full, the teacher hands you a new one automatically, until you hit the maximum stack height. PBR is notebooks labelled A–G and H–Z—you always know which book a name belongs in. LOGGED is keeping a diary of every scribble so you can undo it; NOT LOGGED is scribbling on a whiteboard you will wipe and rewrite from a photocopy. DEFINE NO is not buying the notebook until the first child actually needs to write. Pending changes are “we ordered new covers, but they only go on when we REORG-tidy the shelf.” REORP is “this notebook is taped shut until you tidy it.” AREOR is “you can still write, but the new covers are in a box in the office.”
PBG (partition-by-growth) is the default for small and medium tables without a good range key. PBR (partition-by-range) is for large tables you can split on a key so utilities and queries work on parts. IBM suggests considering PBR if you expect growth well beyond tens of gigabytes.
LOGGED records inserts, updates, and deletes in the recovery log. NOT LOGGED does not, which can speed some bulk operations but leaves you recovering from image copies or reloads rather than rolling forward logs. Catalog database DSNDB06 cannot use NOT LOGGED. XML/LOB spaces inherit the base space logging attribute.
Some ALTER TABLESPACE/TABLE/INDEX options on universal table spaces do not rewrite the object immediately. The object goes advisory REORG-pending (AREOR), rows appear in SYSIBM.SYSPENDINGDDL, and an online REORG applies the new BUFFERPOOL, DSSIZE, SEGSIZE, MEMBER CLUSTER, and similar attributes. DROP PENDING CHANGES backs out unmaterialized ALTERs.
TRACKMOD YES (often the default) records which pages changed in space-map pages, helping incremental COPY. TRACKMOD NO skips that tracking (some insert-heavy shops accept full copies instead). Do not specify TRACKMOD on LOB or work-file spaces.
REORP is a restrictive REORG-pending state: you must REORG before normal use of the affected parts. AREOR is advisory: SQL still runs, but the ALTER has not been applied until REORG SHRLEVEL CHANGE/REFERENCE. Do not confuse the two when reading DISPLAY DATABASE.
1. PBG table spaces grow by:
2. NOT LOGGED means:
3. Pending definition changes are materialized by:
4. DEFINE NO means:
5. MEMBER CLUSTER is aimed at: