Information Schema USER_STATISTICS Table

You are viewing an old version of this article. View the current version here.

The Information Schema USER_STATISTICS table holds statistics about user activity. This is part of the User Statistics feature, which is not enabled by default.

You can use this table to find out such things as which user is causing the most load and which users are being abusive. You can also use this table to measure how close to capacity the server may be.

It contains the following columns:

FieldTypeNotes
USERvarchar(48)The username. The value '#mysql_system_user#' appears when there is no username (such as for the slave SQL thread).
TOTAL_CONNECTIONSint(11)The number of connections created for this user.
CONCURRENT_CONNECTIONSint(11)The number of concurrent connections for this user.
CONNECTED_TIMEint(11)The cumulative number of seconds elapsed while there were connections from this user.
BUSY_TIMEdoubleThe cumulative number of seconds there was activity on connections from this user.
CPU_TIMEdoubleThe cumulative CPU time elapsed while servicing this user's connections.
BYTES_RECEIVEDbigint(21)The number of bytes received from this user's connections.
BYTES_SENTbigint(21)The number of bytes sent to this user's connections.
BINLOG_BYTES_WRITTENbigint(21)The number of bytes written to the binary log from this user's connections.
ROWS_READbigint(21)The number of rows read by this user's connections.
ROWS_SENTbigint(21)The number of rows sent by this user's connections.
ROWS_DELETEDint(21)The number of rows deleted by this user's connections.
ROWS_INSERTEDbigint(21)The number of rows inserted by this user's connections.
ROWS_UPDATEDbigint(21)The number of rows updated by this user's connections.
KEY_READ_HITSbigint(21)From MariaDB 11.5
KEY_READ_MISSESbigint(21)From MariaDB 11.5
SELECT_COMMANDSbigint(21)The number of SELECT commands executed from this user's connections.
UPDATE_COMMANDSbigint(21)The number of UPDATE commands executed from this user's connections.
OTHER_COMMANDSbigint(21)The number of other commands executed from this user's connections.
COMMIT_TRANSACTIONSbigint(21)The number committed transactions. Note that in autocommit mode every statement is a separate transaction.
ROLLBACK_TRANSACTIONSbigint(21)The number of transactions that were rolled back.
DENIED_CONNECTIONSbigint(21)The number of connections denied to this user.
LOST_CONNECTIONSbigint(21)The number of this user's connections that were terminated uncleanly.
ACCESS_DENIEDbigint(21)The number of times this user's connections issued commands that were denied.
EMPTY_QUERIESbigint(21)The number of times this user's connections sent queries to the server that did not return data to the client (a per-user aggregate of the empty_queries status variable).
TOTAL_SSL_CONNECTIONSbigint(21)The number of TLS connections created for this user.
MAX_STATEMENT_TIME_EXCEEDEDbigint(21)The number of times a statement was aborted, because it was executed longer than its MAX_STATEMENT_TIME threshold.

Example

SELECT * FROM information_schema.USER_STATISTICS\G
*************************** 1. row ***************************
                  USER: root
     TOTAL_CONNECTIONS: 1
CONCURRENT_CONNECTIONS: 0
        CONNECTED_TIME: 297
             BUSY_TIME: 0.001725
              CPU_TIME: 0.001982
        BYTES_RECEIVED: 388
            BYTES_SENT: 2327
  BINLOG_BYTES_WRITTEN: 0
             ROWS_READ: 0
             ROWS_SENT: 12
          ROWS_DELETED: 0
         ROWS_INSERTED: 13
          ROWS_UPDATED: 0
       SELECT_COMMANDS: 4
       UPDATE_COMMANDS: 0
        OTHER_COMMANDS: 3
   COMMIT_TRANSACTIONS: 0
 ROLLBACK_TRANSACTIONS: 0
    DENIED_CONNECTIONS: 0
      LOST_CONNECTIONS: 0
         ACCESS_DENIED: 0
         EMPTY_QUERIES: 1

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.