8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00
This commit is contained in:
dimitr 2007-03-21 12:31:30 +00:00
parent cf38a3b37d
commit d76c428702

View File

@ -121,6 +121,16 @@ Monitoring tables
- MON$TIMESTAMP (statement start date/time)
- MON$SQL_TEXT (statement text, if appropriate)
MON$CALL_STACK (call stack of active PSQL requests)
- MON$CALL_ID (request ID)
- MON$STATEMENT_ID (top-level DSQL statement ID)
- MON$CALLER_ID (caller request ID)
- MON$OBJECT_NAME (PSQL object name)
- MON$OBJECT_TYPE (PSQL object type)
- MON$TIMESTAMP (request start date/time)
- MON$SOURCE_LINE (SQL source line number)
- MON$SOURCE_COLUMN (SQL source column number)
Notes:
1) Textual descriptions of all "state" and "mode" values can be found
in the system table RDB$TYPES
@ -134,6 +144,13 @@ Monitoring tables
- columns MON$TRANSACTION_ID and MON$TIMESTAMP contain valid values
for active statements only
4) For table MON$CALL_STACK:
- column MON$STATEMENT_ID groups call stacks by the top-level DSQL statement
that initiated the call chain. This ID represents an active statement
record in the table MON$STATEMENTS.
- columns MON$SOURCE_LINE and MON$SOURCE_COLUMN contain line/column information
related to the PSQL statement being currently executed
Example(s):
1) Retrieve IDs of all CS processes loading CPU at the moment
SELECT MON$SERVER_PID
@ -157,3 +174,20 @@ Monitoring tables
JOIN MON$STATEMENTS STMT ON ATT.MON$ATTACHMENT_ID = STMT.MON$ATTACHMENT_ID
WHERE ATT.MON$ATTACHMENT_ID <> CURRENT_CONNECTION
AND STMT.MON$STATE = 1
5) Retrieve call stacks for all connections
WITH RECURSIVE
HEAD AS
(
SELECT CALL.MON$STATEMENT_ID, CALL.MON$CALL_ID, CALL.MON$OBJECT_NAME, CALL.MON$OBJECT_TYPE
FROM MON$CALL_STACK CALL
WHERE CALL.MON$CALLER_ID IS NULL
UNION ALL
SELECT CALL.MON$STATEMENT_ID, CALL.MON$CALL_ID, CALL.MON$OBJECT_NAME, CALL.MON$OBJECT_TYPE
FROM MON$CALL_STACK CALL
JOIN HEAD ON CALL.MON$CALLER_ID = HEAD.MON$CALL_ID
)
SELECT MON$ATTACHMENT_ID, MON$OBJECT_NAME, MON$OBJECT_TYPE
FROM HEAD
JOIN MON$STATEMENTS STMT ON STMT.MON$STATEMENT_ID = HEAD.MON$STATEMENT_ID
WHERE STMT.MON$ATTACHMENT_ID <> CURRENT_CONNECTION