The Firebird engine can monitor activities in a database and make them available for user queries via the monitoring tables.The definitions of these tables are always present in the database, all named with the prefix MON$
.The tables are virtual: they are populated with data only at the moment when the user queries them.That is also one good reason why it is no use trying to create triggers for them!
The key notion in understanding the monitoring feature is an activity snapshot.The activity snapshot represents the current state of the database at the start of the transaction in which the monitoring table query runs.It delivers a lot of information about the database itself, active connections, users, transactions prepared, running queries and more.
The snapshot is created when any monitoring table is queried for the first time.It is preserved until the end of the current transaction to maintain a stable, consistent view for queries across multiple tables, such as a master-detail query.In other words, monitoring tables always behave as though they were in SNAPSHOT TABLE STABILITY
(“consistency”) isolation, even if the current transaction is started with a lower isolation level.
To refresh the snapshot, the current transaction must be completed and the monitoring tables must be re-queried in a new transaction context.
-
SYSDBA and the database owner have full access to all information available from the monitoring tables
-
Regular users can see information about their own connections;other connections are not visible to them
Warning
|
In a highly loaded environment, collecting information via the monitoring tables could have a negative impact on system performance. |
- [fblangref-appx05-monattach]
-
Information about active attachments to the database
- [fblangref-appx05-moncallstk]
-
Calls to the stack by active queries of stored procedures and triggers
- [fblangref-appx05-moncompst]
-
Virtual table listing compiled statements
- [fblangref-appx05-contxtvars]
-
Information about custom context variables
- [fblangref-appx05-mondb]
-
Information about the database to which the
CURRENT_CONNECTION
is attached - [fblangref-appx05-iostats]
-
Input/output statistics
- [fblangref-appx05-memusage]
-
Memory usage statistics
- [fblangref-appx05-recstats]
-
Record-level statistics
- [fblangref-appx05-statements]
-
Statements prepared for execution
- [fblangref-appx05-tablestats]
-
Table-level statistics
- [fblangref-appx05-transacs]
-
Started transactions