My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
UserTableMonitoring  
Activity monitoring per table, account and index
Updated Feb 4, 2010 by mdcal...@gmail.com

Introduction

We have added code to measure database activity and aggregate the results per account, table and index. We have also added SQL statements to display these values.

One of these days we will integrate this with the information schema.

Details

Note that rows changed includes rows from insert, update, delete and replace statements.

The commands are:

  • SHOW USER_STATISTICS
  • SHOW TABLE_STATISTICS
  • SHOW INDEX_STATISTICS
  • SHOW CLIENT_STATISTICS
  • FLUSH TABLE_STATISTICS
  • FLUSH INDEX_STATISTICS
  • FLUSH CLIENT_STATISTICS

SHOW USER_STATISTICS

This displays resource consumption for all sessions per database account:

  • number of seconds executing SQL commands (wall time and CPU time)
  • number of concurrent connections (the current value)
  • number of connections created
  • number of rollbacks
  • number of commits
  • number of select statements
  • number of row change statements
  • number of other statements and internal commands
  • number of rows fetched
  • number of rows changed
  • number of bytes written to the binlog
  • number of network bytes sent and received
  • number of rows read from any table
  • number of failed attempts to create a connection
  • number of connections closed because of an error or timeout
  • number of access denied errors
  • number of queries that return no rows

SHOW CLIENT_STATISTICS

This has the same values as SHOW USER_STATISTICS but they are aggregated by client IP address rather than by database account name.

SHOW TABLE_STATISTICS

This displays the number of rows fetched and changed per table. It also displays the number of rows changed multiplied by the number of indexes on the table.

SHOW INDEX_STATISTICS

This displays the number of rows fetched per index. It can be used to find unused indexes.

Flush commands

Each of the flush commands clears the counters used for the given SHOW command.

Comment by CharminS...@gmail.com, Oct 20, 2008

Sounds very useful. I'll look for a download. (I guess it is available somewhere?)

Comment by CharminS...@gmail.com, Oct 20, 2008

I found it in SVN.

Comment by arjen.le...@gmail.com, Nov 1, 2008

Updated version (still MySQL 5.0) is in the OurDelta? patchset and builds (http://ourdelta.org) For instance, the original patch produced additional reserved words in the parser.

Comment by vas...@gmail.com, Nov 10, 2008

Would be good to add bytes counts too. And counts for disk I/O if possible at all.

Comment by Mr.lip...@gmail.com, Mar 26, 2009

It's work in 5.1.32 ???


Sign in to add a comment
Powered by Google Project Hosting