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:
1
2
3
4
SELECT `post_type`, COUNT(*)
FROM `wp_posts`
GROUP BY `post_type`
ORDER BY `COUNT(*)` DESC;
  • map and monitor the meta_key(s) in wp_postmeta, more-or-less the output of the following query:
1
2
3
4
SELECT `meta_key`, COUNT(*)
FROM `wp_postmeta`
GROUP BY `meta_key`
ORDER BY `COUNT(*)` DESC;

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.