Breaking News
Loading...
08/12/2013

Using the USER_STATISTICS Tables

Percona Server and MariaDB include additional INFORMATION_SCHEMA tables for object level
usage statistics. These were originally created at Google. They are extremely useful for finding out how much or little the various parts of your server are actually used. In a large enterprise, where the DBAs are responsible for managing the databases and have little control over the developers, they can be vital for measuring and auditing database activity and enforcing usage policies. They’re similarly useful for multitenant applications such as shared hosting environments. When you’re hunting for performance problems, on the other hand, they can be great for helping you figure out who’s spending the most time in the database or what tables and indexes are most or least used.
Here are the tables:

mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE '%_STATISTICS';
+---------------------------------------------+
| Tables_in_information_schema (%_STATISTICS) |
+---------------------------------------------+
| CLIENT_STATISTICS |
| INDEX_STATISTICS |
| TABLE_STATISTICS |
| THREAD_STATISTICS |
| USER_STATISTICS |
+---------------------------------------------+

We don’t have space for examples of all the queries you can perform against these
tables, but a couple of bullet points won’t hurt:
• You can find the most-used and least-used tables and indexes, by reads, updates,
or both.
• You can find unused indexes, which are candidates for removal.
• You can look at the CONNECTED_TIME versus the BUSY_TIME of the replication user to
see whether replication will likely have a hard time keeping up soon.
In MySQL 5.6, the Performance Schema adds tables that serve purposes similar to the
aforementioned tables.

Refer: http://www.mysqlperformanceblog.com/2008/09/12/googles-user_statistics-v2-port-and-changes/

0 comments:

Post a Comment

 
Toggle Footer