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.

Access Security

  • 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.

List of Monitoring Tables

Information about active attachments to the database

Section E.2, MON$CALL_STACK

Calls to the stack by active queries of stored procedures and triggers

Information about custom context variables

Section E.4, MON$DATABASE

Information about the database to which the CURRENT_CONNECTION is attached

Input/output statistics

Section E.6, MON$MEMORY_USAGE

Memory usage statistics

Record-level statistics

Section E.8, MON$STATEMENTS

Statements prepared for execution

Table-level statistics

Section E.10, MON$TRANSACTIONS

Started transactions

E.1 MON$ATTACHMENTS

MON$ATTACHMENTS displays information about active attachments to the database.

Retrieving information about client applications

Monitoring tables are read-only. However, the server has a built-in mechanism for deleting (and only deleting) records in the MON$ATTACHMENTS table, which makes it possible to close a connection to the database.

Notes

  • All the current activity in the connection being deleted is immediately stopped and all active transactions are rolled back

  • Subsequent attempts to use this connection (i.e., use its handle in API calls) will return errors

Closing all connections except for your own (current):

  1. WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION