Three system tables store information about segments: master..sysusages and two system tables in the user database, sysindexes and syssegments. sp_helpsegment uses these tables. Additionally, it finds the database device name in sysdevices.
When you allocate a device to a database with create database or alter database, Adaptive Server adds a row to master..sysusages. The segmap column in sysusages provides bitmaps to the segments in the database for each device.
create database also creates the syssegments table in the user database with these default entries:
segment name status ------- --------------- ------ 0 system 0 1 default 1 2 logsegment 0
When you add a segment to a database with sp_addsegment, the procedure:
Adds a new row to the syssegments table in the user database, and
Updates the segmap in master..sysusages.
When you create a table or an index, Adaptive Server adds a new row to sysindexes. The segment column in that table stores the segment number, showing where the server will allocate new space for the object. If you do not specify a segment name when you create the object, it is placed on the default segment; otherwise, it is placed on the specified segment.
If you create a table containing text or image columns, a second row is also added to sysindexes for the linked list of text pages; by default, the chain of text pages is stored on the same segment as the table. An example using sp_placeobject to put the text chain on its own segment is included under “A segment tutorial”.
The name from syssegments is used in create table and create index statements. The status column indicates which segment is the default segment.
See “System tables that manage space allocation” for more information about the segmap column and the system tables that manage storage.