A table is a logical description. A table space is the VSAM page set where rows live. DB2 CREATE TABLESPACE is how you choose that page set’s type, size, and partitioning. This page covers the DDL: simple and segmented legacy types, universal table spaces, LOB and XML spaces, page sizes, DSSIZE, MAXPARTITIONS, SEGSIZE, and NUMPARTS. Logging, MEMBER CLUSTER, and pending ALTERs are on the design-options page that follows.
CREATE TABLESPACE names a space inside a database (IN dbname, default often DSNDB04). USING STOGROUP or USING VCAT says who allocates the data set. One modern universal table space holds one table. That 1:1 rule is the biggest mental shift from old simple spaces that mixed many tables in one VSAM cluster.
12345678CREATE TABLESPACE EMPTS IN HRDB USING STOGROUP HRSTO MAXPARTITIONS 32 SEGSIZE 32 DSSIZE 4G BUFFERPOOL BP2 LOCKSIZE ROW;
| Type | Notes |
|---|---|
| Simple | Legacy; multiple tables; do not use for new objects |
| Segmented (classic) | Legacy segmented; one or more tables; superseded by UTS |
| Classic partitioned | NUMPARTS without SEGSIZE; range parts, not UTS |
| UTS PBG | MAXPARTITIONS + SEGSIZE; parts grow as data grows |
| UTS PBR | NUMPARTS + SEGSIZE; parts by key range |
| LOB / XML | Auxiliary spaces for large objects / XML |
Simple table spaces could hold multiple tables with no segmented space map. Mass delete and space reuse were painful. They are deprecated for new work. If you inherit one, the long-term plan is usually to move the table into a UTS (often via pending ALTER + REORG, or UNLOAD/LOAD).
Classic segmented spaces use a segment size (SEGSIZE) so each table owns whole segments. Space reuse and DROP/mass delete are better than simple spaces. They can still hold more than one table. New objects should be UTS instead: you keep segmented management inside each partition without sharing the space among tables.
CREATE TABLESPACE with SEGSIZE and without NUMPARTS or MAXPARTITIONS is the classic segmented (non-UTS) path. Do not copy that pattern from twenty-year-old DDL generators without checking shop standards.
Universal table spaces (UTS) combine partitioned structure with segmented space management, one table per space:
PBG is the usual implicit space for CREATE TABLE. PBR is the usual choice for large tables with a natural key (account, date, region). Details and logging options belong on the PBG/PBR design page; here remember the DDL knobs that select the type.
NUMPARTS without SEGSIZE creates a classic partitioned table space (not UTS). Range partitioning without segmented pages inside the part. New designs should add SEGSIZE so you get PBR UTS instead.
LOB table spaces (CREATE TABLESPACE ... LOB) hold auxiliary data for CLOB, BLOB, and DBCLOB columns. The base table keeps a ROWID (and inline bytes if you defined inline LOBs). XML table spaces similarly hold XML storage for XML columns. You do not SELECT from these spaces as if they were the base table; Db2 names them and you REORG/COPY them as part of the table’s storage set. Logging and some attributes are inherited from the base table space.
Page size is chosen by BUFFERPOOL:
A row cannot span pages in the ordinary base-table sense (except the overflow/pointer mechanisms for varying rows). If the maximum row length will not fit, CREATE TABLE fails or you must raise the page size. Compression and MAXROWS also interact with page size. Changing BUFFERPOOL on an existing UTS is often a pending definition change materialized by REORG.
DSSIZE is the data set size for each partition, specified in gigabytes (for example DSSIZE 4G). Each partition occupies one data set (more pieces can exist for non-partitioned index spaces via PIECESIZE, which is an index topic). Total PBG capacity is roughly MAXPARTITIONS × DSSIZE, further limited by page size. IBM notes PBG can grow very large (up to the documented 128 TB class ceiling depending on page size and those two knobs) but recommends PBR once you expect far beyond tens of gigabytes and have a partitioning key.
PBR with relative page numbering (RPN) allows more flexible per-part DSSIZE growth than absolute page numbering. PAGENUM RELATIVE vs ABSOLUTE is specified on CREATE TABLESPACE or taken from PAGESET_PAGENUM.
123456789101112131415-- PBR UTS: range parts + segmented pages CREATE TABLESPACE TS1 IN DSN8D12A USING STOGROUP DSN8G120 NUMPARTS 55 SEGSIZE 16 LOCKSIZE ANY; -- PBG UTS: growth parts CREATE TABLESPACE TSG IN DSN8D12A USING STOGROUP DSN8G120 MAXPARTITIONS 20 SEGSIZE 32 DSSIZE 4G;
You can also skip CREATE TABLESPACE and use CREATE TABLE PARTITION BY RANGE (...), which creates a PBR space for you, or a plain CREATE TABLE that implicitly creates PBG. Explicit DDL is clearer in production reviews.
A table space is the notebook the table writes in. Simple notebooks let every subject share one messy book. Segmented notebooks give each subject its own chunks of pages. Universal notebooks are fancy: either the notebook grows a new chapter when it runs out of paper (PBG) or you decide “chapter 1 is A–M and chapter 2 is N–Z” (PBR). DSSIZE is how thick each chapter is allowed to be. SEGSIZE is how many pages you buy in a pack. LOB/XML notebooks are extra sketchbooks for huge drawings that do not fit on a normal ruled page.
CREATE TABLESPACE defines the VSAM page set that stores table rows. You name the space, the database (IN), storage (USING STOGROUP or VCAT), and design options such as SEGSIZE, NUMPARTS, MAXPARTITIONS, DSSIZE, and BUFFERPOOL (which also sets page size).
Universal table spaces: partition-by-growth (PBG) when you have no good range key and the table is small to medium, or partition-by-range (PBR) when you can partition on a key and expect large growth. Avoid new simple or classic segmented multi-table spaces.
DSSIZE is partition data-set size in gigabytes. MAXPARTITIONS is how many partitions a PBG space may grow to. NUMPARTS is how many range partitions a PBR (or classic partitioned) space has. SEGSIZE is segment size in pages and is required for UTS segmented organization.
The buffer pool name implies page size: BP0–BP49 are 4 KB, BP8K* are 8 KB, BP16K* 16 KB, BP32K* 32 KB. Larger pages help wide rows and some compression patterns; they also change how many rows fit and the maximum rows per page.
Yes. CREATE TABLE without an explicit IN clause can implicitly create a PBG table space using subsystem defaults. Explicit CREATE TABLESPACE is still the DBA-controlled path for production sizes, names, and STOGROUPs.
1. What CREATE TABLESPACE combination creates a PBG universal table space?
2. What does DSSIZE control?
3. Simple table spaces are:
4. SEGSIZE is specified in:
5. LOB table spaces hold: