DB2 Simple Table Space

DB2 Table Space DB2 Segmented Table Space

Table space will be represented as pages and data will be stored in the form of pages.

More than one table can be stored in the table space.

Page contains all the table rows in which order they inserted into the table.

The rows from different tables can be stored in one page.

There is no order defined to store the data on the pages.

CREATE TABLESPACE is used to create the table space.


CREATE TABLESPACE tablespace-name
       IN database-name            
       USING STOGROUP stored-group-name
       PRIQTY priqty-value     
       SECQTY secqty-value            
       ERASE {NO/YES}
       FREEPAGE freepage-value           
       PCTFREE pctfree-value           
       BUFFERPOOL bufferpool-value     
       LOCKSIZE {ANY/locksize-value}
       LOCKMAX {SYSTEM/lockmax-value}
       CLOSE {YES/NO}    

The above parameters are explained in table space concept and find the page here .

Practical Example:

Below example is to create MFTHTS table space in MTH1DB under the storage group MFTCHP

       IN MTH1DB            
       PRIQTY 250           
       SECQTY 100            
       ERASE NO             
       FREEPAGE 10           
       PCTFREE 10           
       COMPRESS NO          
       BUFFERPOOL MF      
       LOCKSIZE ANY         
       LOCKMAX SYSTEM       
       CLOSE YES    

DB2 Table Space DB2 Segmented Table Space