Comments - User Statistics

12 years, 6 months ago openiduser7

Would be nice to have a short hand notation for these i.e.

SHOW CLIENT_STATS

and have one

SHOW ALL_STATS

to show all 4 CLIENT, USER, INDEX and TABLE stats together

i.e.

*************************** 1. row ***************************
                Client: localhost
     Total_connections: 3
Concurrent_connections: 0
        Connected_time: 57
             Busy_time: 0.003799
              Cpu_time: 0.0016372
        Bytes_received: 346
            Bytes_sent: 10184
  Binlog_bytes_written: 0
             Rows_read: 0
             Rows_sent: 12
          Rows_deleted: 0
         Rows_inserted: 9
          Rows_updated: 0
       Select_commands: 3
       Update_commands: 0
        Other_commands: 0
   Commit_transactions: 0
 Rollback_transactions: 0
    Denied_connections: 0
      Lost_connections: 0
         Access_denied: 0
         Empty_queries: 2
*************************** 1. row ***************************
                  User: root
     Total_connections: 3
Concurrent_connections: 0
        Connected_time: 57
             Busy_time: 0.003921
              Cpu_time: 0.0017561
        Bytes_received: 373
            Bytes_sent: 11915
  Binlog_bytes_written: 0
             Rows_read: 0
             Rows_sent: 13
          Rows_deleted: 0
         Rows_inserted: 10
          Rows_updated: 0
       Select_commands: 3
       Update_commands: 0
        Other_commands: 0
   Commit_transactions: 0
 Rollback_transactions: 0
    Denied_connections: 0
      Lost_connections: 0
         Access_denied: 0
         Empty_queries: 2
*************************** 1. row ***************************
           Table_schema: mysql
             Table_name: user
              Rows_read: 6
           Rows_changed: 0
Rows_changed_x_#indexes: 0
*************************** 2. row ***************************
           Table_schema: mysql
             Table_name: db
              Rows_read: 2
           Rows_changed: 0
Rows_changed_x_#indexes: 0
 
10 years, 7 months ago Federico Razzoli

Please note that it is trivial to create stored procedures which do that:

DELIMITER ||

CREATE PROCEDURE `show_all_stats`()
	READS SQL DATA
	COMMENT 'SHOW all user statistics'
BEGIN
	SELECT 'CLIENT_STATISTICS:' AS `Note`;
	SHOW CLIENT_STATISTICS;
	SELECT 'USER_STATISTICS:' AS `Note`;
	SHOW USER_STATISTICS;
	SELECT 'INDEX_STATISTICS:' AS `Note`;
	SHOW INDEX_STATISTICS;
	SELECT 'TABLE_STATISTICS:' AS `Note`;
	SHOW TABLE_STATISTICS;
END;

CREATE PROCEDURE `flush_all_stats`()
	MODIFIES SQL DATA
	COMMENT 'FLUSH all user statistics'
BEGIN
	FLUSH CLIENT_STATISTICS;
	FLUSH USER_STATISTICS;
	FLUSH INDEX_STATISTICS;
	FLUSH TABLE_STATISTICS;
END;

||
DELIMITER ;
COMMIT;
 
11 years, 2 months ago Michael Widenius

There is already commands "SHOW USER_STATISTICS", "SHOW CLIENT_STATISTICS" etc.

It's not possible to have all of these in one query as the tables have different columns.

 
12 years, 6 months ago Daniel Bartholomew

These sound like good ideas. Send them to the Maria Developers list and see if there is interest from the developers in implementing them.

 
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.