<< Index/Indices | IBExpert | SQL code editor >>
System objects RDB$, MON$, IBE$
Firebird/InterBase® and IBExpert generate system database objects, and store their own specific system information about the database objects in system tables. System objects are displayed in the DB Explorer in red, if the system options have been flagged in the Register Database dialog (called using the right mouse button Additional/DB Explorer).

Firebird and InterBase® system objects contain the prefix RDB$ and Firebird monitoring tables contain the prefix MON$; IBExpert system objects contain the prefix IBE$.

A newly created database is almost 0,5 MB large. This is due to the system tables that are automatically generated by Firebird/InterBase® when a database is created.
new:
These system tables contain a wealth of information, which IBExpert uses in many of its functionalities. Although you may consult and study the information in these system objects, please do not manipulate any data contained in them, as it will almost certainly result in a corrupt database!
RDB$ system objects
These are the Firebird and InterBase® objects. All field names in these tables are also prefixed RDB$ for identification. They include the following:
System tables relating to the database
RDB$DATABASE: as with all system tables there is column included for a description, to aid database documentation. Since IBExpert version 2012.11.15, a database description can be specified and is subsequently displayed in the SQL Assistant, on the Descriptions page. The database description is also now included in the HTML documentation if the Include descriptions... option is enabled. This table also includes theRDB$CHARACTER_SET_NAMEcolumn, displaying the database default character set.RDB$FILE: administrates all secondary files and shadows, if any exist. TheRDB$FILE_SEQUENCEcolumn contains aSMALLINTnumber specifying the file sequence. A miximum of 65535 secondary database files and shadow files are permitted.RDB$PAGES: administrates the database pages.RDB$RELATION_IDpoints to the respective table andRDB$PAGE_TYPEspecifies whether it is a data or index page.RDB$DEPENDENCIES: this displays dependencies between tables, views and constraints:

RDB$DEPENDENT_NAME and the element upon which the other element is dependent is displayed in the RDB$DEPENDED_ON_NAME. If the dependency is on a column, then this is named in RDB$FIELD_NAME.
System tables relating to tables and views
* RDB$RELATIONS: all tables and views are stored in this table. View definitions are stored in RDB$VIEW_SOURCE; the binary definition in RDB$VIEW_BLR. System tables are flagged with a 1 in the RDB$SYSTEM_FLAG column, user tables with 0. If the table is an external file, its name can be found in the RDB$EXTERNAL_FILE column. The table owner is named in the RDB$OWNER_NAME field.
RDB$RELATION_FIELDS: stores the column definitions of the individual tables. The sequence in which Firebird/InterBase® displays individual fields following aSELECT *query, is determined by the value inRDB$FIELD_POSITIONcolumn, the value 0 appearing first. Each table column is based on a domain, which is displayed inRDB$FIELD_SOURCE. If a field has been specified asNOT NULL, the value 1 is displayed in theRDB$NULL_FLAGcolumn. An anomalous collation order can be viewed in theRDB$COLLATION_IDcolumn.RDB$RELATION_CONSTRAINTS: constraints, in the broadest sense, can be found in this table. The name is stored inRDB$CONSTRAINT_NAME, the respective table inRDB$RELATION_NAME.RDB$CONSTRAINT_TYPEcontains one of the following values:PRIMARYfor primary keysUNIQUEfor secondary keysFOREIGN KEYfor foreign keysPCHECKfor user-defined validity checks andNOT NULLfor forcing data input.

* RDB$INDICES: here you can view the index names (RDB$INDEX_NAME) and the table names (RDB$RELATION_NAME). Those indices belonging to a specific table are numbered sequentially, beginning with the number 1 (displayed in RDB$INDEX_ID). Unique indices are displayed in RDB$UNIQUE_FLAG with the flag 1, RDB$INDEX_TYPE shows whether the index is ascending (0) or descending (1) and RDB$INDEX_INACTIVE displays inactive indices with the value 1. The index selectivity is stored in the RDB$STATISTICS column.
RDB$INDEX_SEGMENTS: this stores the columns that the index is composed of. Their order can be viewed in theRDB$FIELD_POSITION.RDB$REF_CONSTRAINTS: this stores how key violations are to be handled. The foreign key name can be found inRDB$CONSTRAINT_NAME, the corresponding primary key or secondary keys can be viewed inRDB$CONST_NAME_UQ. Specification of the treatment of key violations can be separately defined forUPDATEandDELETEactions and can be viewed inRDB$UPDATE_RULEandRDB$DELETE_RULErespectively. Actions include the default value,RESTRICT,NO ACTION,CASCADE,SET NULLandSET DEFAULT.RDB$CHECK_CONSTRAINTS: validity checks are stored here. Validity checks are made using triggers, the trigger name can be seen in the column,RDB$TRIGGER_NAME, and the name of the validity check inRDB$CONSTRAINT_NAME. If the name of a column is displayed in theRDB$TRIGGER_NAMEcolumn, then this indicates aNOT NULLconstraint, which are also stored in this table.RDB$VIEW_RELATIONS: this system table stores all tables belonging to a view. The individual tables are numbered sequentially in theRDB$VIEW_CONTEXTcolumn. If a table alias is used, this is displayed in theRDB$CONTEXT_NAMEfield.
System tables relating to domains
RDB$FIELDS: this stores the definition of all domains, including data type, size, character set and collation. If a field definition includes a computed by statement, this can be viewed inRDB$COMPUTED_SOURCE.-
RDB$TYPES: this stores datatypes and object types (VIEW,TRIGGER,PROCEDURE), character sets and some other information. RDB$FIELD_DIMENSIONS: this stores array definitions.RDB$CHARACTER_SETS: here you can find a full list of character sets available in your Firebird/InterBase® version.RDB$COLLATIONS: this table stores a list of all collations available for the character set IDs, found inRDB$CHARACTER_SETS.
System tables relating to procedures and triggers
RDB$PROCEDURES: all stored procedures in a database are stored in this system table. The procedure name is stored inRDB$PROCEDURE_NAMEand it is allocated a sequential numbered identifier inRDB$PROCEDURE_ID. The number of parameters can be viewed in theRDB$PROCEDURE_INPUTScolumn the values output by the procedure inRDB$PROCEDURE_OUTPUTS. The source code is stored inRDB$PROCEDURE_SOURCEand its binary translation inRDB$PROCEDURE_BLR. Only the procedure owner (displayed inRDB$OWNER_NAME) and the SYSDBA may assign rights to a procedure.RDB$PROCEDURE_PARAMETERS: this stores information about the individual parameters, and in which procedure they are used. The individual parameters are each assigned a sequential number beginning with 0. If the field,RDB$PARAMETER_TYPEdisplays the value 0, then it is an input parameter, an output parameter displays the value 1. This also references theRDB$FIELDSsource.RDB$TRIGGERS: this table stores a list of all triggers in the database. Along with the trigger name you can find the name of the corresponding table (RDB$RELATION_NAME) to which the trigger applies, the trigger type (RDB$TRIGGER_TYPE) and, if several triggers for a single table have the sameRDB$TRIGGER_TYPEvalue, the field,RDB$TRIGGER_SEQUENCEdecides in which order the triggers are executed, starting with the lowest value. If duplicate values are found in this column the triggers with the same value are executed in alphabetical order. The trigger source code can be found inRDB$TRIGGER_SOURCEwith its binary translation inRDB$TRIGGER_BLR. Deactivated triggers are flagged with a 1 in theRDB$TRIGGER_INACTIVEcolumn.
System tables relating to user rights
RDB$ROLES: this includes the role names defined for the database and the role owners, the users who defined them.RDB$PRIVILEGES: this table stores details of which rights which users have received and who granted them. TheRDB$PRIVILEGEfield displays the type of right granted:S(select),I(insert),U(update),D(delete),R(reference),X(execute). If theRDB$GRANT_OPTIONfield is flagged with 1, then the grantee may grant this right to to others.RDB$RELATION_NAMEshows for which table or procedure the permissions have been granted, and if the permission is restricted to a specific column, this is displayed in theRDB$FIELD_NAMEfield.
Other system tables
RDB$EXCEPTIONS: contains a full list of all exceptions.RDB$FILTERS: this table contains all blob filters. The routine is specified inRDB$ENTRYPOINT, the DLL file name inRDB$MODULE_NAME.RDB$FUNCTIONS: this includes all UDFs incorporated in the database. The routine is specified inRDB$ENTRYPOINTand the DLL file name inRDB$MODULE_NAME.RDB$RETURN_ARGUMENTdisplays which of the parameters is the return value.RDB$FUNCTION_ARGUMENTS: this table lists the individual UDF parameters. The parameters are numbered sequentially inRDB$ARGUMENT_POSITION, parameter types are displayed inRDB$FIELD_TYPE, this column referencing the table,RDB$TYPES.RDB$MECHANISMdisplay either the value 0 when the parameter is passed by value, and 1 when the parameter is passed by reference. Particularly of interest with strings is the length recorded inRDB$FIELD_LENGTH.RDB$CHARACTER_SET_IDindicates the character set.
* RDB$GENERATORS: this table stores the generator name and a unique number. The generator value is not stored in this system table.
RDB$TRANSACTIONS: this system table displays transactions running across multiple databases. 0 indicates that the transaction is in limbo, 1 that it has been committed, 2 that it has been rolled back.
See also:
The mystery of RDB$DB_KEY
Firebird Internals
Firebird Database Cache Buffer: The Firebird cache
MON$ system tables
Firebird monitoring tables were introduced in Firebird 2.1. and enable run-time database snapshot monitoring (of transactions, tables, etc.) via SQL over some new virtualized system tables.
By querying these system tables you get a snapshot of the current activities in the database. For example, MON$DATABASE provides a lot of the database header information that could not be obtained previously via SQL: such details as the on-disk structure (ODS) version, SQL dialect, sweep interval, OIT and OAT and so on.
You can view other activites, such as who is connected to your database, which transactions and statements are running and so on. You even can cancel a running query by executing a DELETE statement on MON$STATEMENTS.
When querying the monitor tables it's important to remember that it's just a snapshot.
The Firebird MON$ system tables include the following in Firebird version 2.1:
MON$DATABASE: connected database.MON$ATTACHMENTS: connected attachments.MON$TRANSACTIONS: started transactions.MON$STATEMENTS: prepared statements.MON$CALL_STACK: call stack of active PSQL requests.MON$IO_STATS: I/O statistics.MON$RECORD_STATS: record-level statistics.
Further details can be found in the Firebird 2.1 Release Notes chapter, Administrative features, and in the Firebird 2.5 Release Notes.
The following improvements have been incorporated in Firebird 2.5:
MON$CONTEXT_VARIABLES: delivers data about context variables, (includes an overview of all user-defined context variables set byRDB$SET_CONTEXT).MON$MEMORY_USAGE: includes current memory usage at database, session, transaction or statement level) in ODS 11.2 and higher databases. Also, in these databases, it becomes possible to terminate a client connection from another connection through theMON$structures.- The original design in Firebird 2.1 allowed non-privileged database users to see monitoring information pertaining only to their
CURRENT_CONNECTION. In Firebird 2.5 they can request information for any attachment that was authenticated using the same user name. - New
MON$metadata for ODS 11.2 databases. - Terminating a client: the
MON$structures are, by design, read-only. Thus, user DML operations on them are prohibited. However, a mechanism is built in to allow deleting (only) of records in theMON$STATEMENTSandMON$ATTACHMENTStables. The effect of this mechanism is to make it possible, respectively, to cancel running statements and, for ODS 11.2 databases, to terminate client sessions.
DELETE FROM MON$STATEMENTS
WHERE MON$ATTACHMENT_ID = 32
ME" connection:
DELETE FROM MON$ATTACHMENTS
WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION
See also:
Firebird Internals
Firebird Database Cache Buffer: The Firebird cache
IBE$ system objects
IBExpert creates its own system objects to support features such as logging and version history:

These objects should not be manipulated in any way, otherwise certain IBExpert functionalities will be detrimentally affected.
IBE$VERSION_HISTORY system table
A special browser is implemented for the IBE$VERSION_HISTORY table. When IBE$VERSION_HISTORY is opened in the Table Editor, a new Version Browser page is automatically opened:

Select the database object and the versions you wish to compare. Text and code is highlighted according to whether it has been added, modified or deleted.
See also:
Verson History
back to top of page
<< Index/Indices | IBExpert | SQL code editor >>






