I’m working on a plugin for WordPress, currently it is totally work-in-progress.

The idea is to:

  • monitor database growth;
  • map and monitor the content-type(s) in wp_posts, more-or-less the output of the following query:

[cc lang=”mysql”]SELECT `post_type`, COUNT(*)
FROM `wp_posts`
GROUP BY `post_type`
ORDER BY `COUNT(*)` DESC;[/cc]

  • map and monitor the meta_key(s) in wp_postmeta, more-or-less the output of the following query:

[cc lang=”mysql”]SELECT `meta_key`, COUNT(*)
FROM `wp_postmeta`
GROUP BY `meta_key`
ORDER BY `COUNT(*)` DESC;[/cc]
The repository is on GitHub:  https://github.com/canepa/db-profiler

The trick is measuring the data once a day and identifying and troubleshooting database growth anomalies.