Overview
ZiziCache includes a database growth monitor that compares current table sizes with the previous snapshot and flags unusual growth. It uses information_schema.TABLES and stores a small history in WordPress options for the admin UI and REST API.
What is measured
- Per‑table size (data + indexes) and row counts.
- Total database size (sum of all table sizes).
- Growth rate derived from historical snapshots (used for weekly growth reporting in the UI).
How monitoring runs
- Runs on a daily WP‑Cron hook:
zizi_cache_db_monitor. - Monitoring is enabled/disabled by
db_growth_monitoring. When disabled, the cron hook is cleared. - Snapshots are stored in options:
zizi_cache_db_table_sizes,zizi_cache_db_total_sizeandzizi_cache_db_size_history(last 30 entries).
Alerts (what actually triggers an email)
- An alert is generated when a table grows by more than 30% per day (normalized) and the table is larger than 5 MB.
- Alerts are stored in
zizi_cache_db_alertsand sent by email. - Recipients are taken from
db_growth_alert_emails(comma‑separated). If empty, the WordPress admin email is used. - Hooks available for integrations:
zizi_cache_db_alert_recipientsandzizi_cache_db_growth_alert.
Adaptive cleanup schedule (optional)
If db_adaptive_cleaning is enabled, ZiziCache can update db_schedule_clean based on the calculated weekly growth rate:
- > 10% weekly growth →
daily - 5-10% weekly growth →
twice_daily - < 1% weekly growth →
weekly
If adaptive cleaning is disabled, the schedule is only recommended (no automatic change).
REST API endpoints
GET /wp-json/zizi-cache/v1/database-growth-history– growth history, alerts, and weekly growth rate (supports?days=and?t=1to force a new snapshot).GET /wp-json/zizi-cache/v1/database-statistics– current table sizes, total size, fragmentation, and chart data.
Limitations (not implemented)
- No predictive analysis, performance impact reports, or scheduled reporting.
- No fragmentation alerts or size‑limit alerts.
- No dashboard notifications beyond the stored alerts data.