After the root dbspace exists, and a database has been created, users with the necessary SQL privileges can create a database table. When users create a table, the database server allocates disk space for the table in units called extents (see what is an extent in the chapter on where data is stored in the IBM Informix Administrator's Guide). The paragraphs that follow describe the major events that occur when the database server creates a table and allocates the initial extent of disk space.
The database server searches the chunk free-list pages in the dbspace for contiguous free space equal to the initial extent size for the table. When adequate space is found, the pages are allocated, and the associated chunk free-list page is updated.
If the database server cannot find adequate contiguous space anywhere in the dbspace, it allocates to the table the largest available amount of contiguous space. No error message is returned if an allocation is possible, even when the amount of space allocated is less than the requested amount. If the minimum extent size cannot be allocated, an error is returned. (Extents cannot span two chunks.)
The database server adds a one-page entry for this table to the tblspace tblspace in this dbspace. The tblspace number assigned to this table is derived from the logical page number in the tblspace tblspace where the table is described. See Tblspace Numbers.
The tblspace number indicates the dbspace where the tblspace is located. Tblspace extents can be located in any of the dbspace chunks.
If you must know exactly where the tblspace extents are located, execute the oncheck -pe command for a listing of the dbspace layout by chunk.
The table itself is fully described in entries stored in the system catalog tables for the database. Each table is assigned a table identification number or tabid. The tabid value of the first user-defined table object in a database is always 100. (The object whose tabid = 100 might also be a view, synonym, or a sequence.) For a complete discussion of the system catalog, see the IBM Informix Guide to SQL: Reference.
A table can be located in a dbspace that is different than the dbspace that contains the database. The tblspace itself is the sum of allocated extents, not a single, contiguous allocation of space. The database server tracks tblspaces independently of the database.
The tasks involved in creating temporary tables are similar to the tasks that the database server performs when it adds a new permanent table. The key difference is that temporary tables do not receive an entry in the system catalog for the database. For more information, see the section defining a temporary table, in the chapter on where data is stored in the IBM Informix Administrator's Guide.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]