# generate a per-datebase usage report

**URL:** <https://forums.percona.com/t/generate-a-per-datebase-usage-report/2557>\
**Category:** Percona Toolkit\
**Created:** [May 19, 2012, 3:26am UTC](https://forums.percona.com/t/generate-a-per-datebase-usage-report/2557 "2012-05-19T03:26:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tolland](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@tolland](https://forums.percona.com/u/tolland)\
**Post date:** [May 19, 2012, 3:26am UTC](https://forums.percona.com/t/generate-a-per-datebase-usage-report/2557/1 "2012-05-19T03:26:24Z")

</div>

For shared hosting, or systems where there are many co-installed databases I would like to identify those which have high resource requirements, and any of those that are not in use.

Presumably I could either sample the data, using something like pt-collect, or I could configure the slow.log to log to disk some query event data.

Is there a preferred solution for this task?

---

<div class="post-metadata">

**Author:** ![jaime](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@jaime](https://forums.percona.com/u/jaime)\
**Post date:** [March 13, 2013, 1:00am UTC](https://forums.percona.com/t/generate-a-per-datebase-usage-report/2557/2 "2013-03-13T01:00:48Z")

</div>

If you’re using Percona Server, you can enable User Statistics. More information on this feature is found in [http://www.percona.com/doc/percona-server/5.5/diagnostics/us](http://www.percona.com/doc/percona-server/5.5/diagnostics/us) er\_stats.html?id=percona-server:features:userstatv2

When enabled, you can query table usage:  
mysql\> SELECT \* FROM INFORMATION\_SCHEMA.TABLE\_STATISTICS  
WHERE TABLE\_NAME=`tables_priv`;  
±-------------±------------------------------±----------+ --------------±-----------------------+  
| TABLE\_SCHEMA | TABLE\_NAME | ROWS\_READ | ROWS\_CHANGED | ROWS\_CHANGED\_X\_INDEXES |  
±-------------±------------------------------±----------+ --------------±-----------------------+  
| mysql | tables\_priv | 2 | 0 | 0 |  
±-------------±------------------------------±----------+ --------------±-----------------------+

Please let me know if you have any questions.
