Drupal is a registered trademark of Dries Buytaert

Optimize Database Tables keeps your Drupal site lean by running OPTIMIZE on MySQL/MariaDB tables & VACUM on PostgreSQL tables, with a simple admin UI and Drush command, per-table control, and clear before/after space savings.

Features

  • Optimize all database tables or only a selected list.
  • Admin UI with safe, batch-based execution and progress feedback.
  • Drush command with progress bar and optional per-table details.
  • Summary messages showing total size before/after and space saved.
  • Minimal configuration: choose "All tables" or maintain a table list.

Post-Installation

  1. Go to Configuration → System → Optimize Database Tables (path: /admin/config/system/database_optimize_tables).
  2. Choose whether to optimize all tables or select specific tables.
  3. Start the optimization from the UI, or run it via Drush:
drush optimize_database_tables:run
# Alias
drush optimize-dbt:run
# Show per-table details
drush optimize-dbt:run --details

The UI uses Drupal's Batch API so processes are resilient to timeouts. After completion, you will see before/after sizes and the amount of space reclaimed.

Additional Requirements

  • Drupal core 10 or 11.
  • Database: MySQL, MariaDB & PostgreSQL
  • Optional: Drush for command-line usage.

Similar projects

  • OptimizeDB — A Drupal module focused on optimizing MySQL/MariaDB tables.
  • DB Maintenance — Provides general database maintenance tasks and scheduling options.

Supporting this Module

Feedback and contributions are welcome via the issue queue. If you find this useful, consider reporting your use case and results to help guide future improvements.

Community Documentation

  • README in the project repository covers features, services, routes, and troubleshooting.

Notes:

  • On large tables, optimization can take time and may lock tables temporarily—run during low-traffic periods.
  • Always ensure you have a recent backup before running database maintenance.
  • This module targets MySQL/MariaDB & PostgreSQL

Activity

Total releases
3
First release
Oct 2025
Latest release
2 days ago
Release cadence
73 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.2.0 Stable Mar 1, 2026
1.1.0 Stable Oct 18, 2025
1.0.0 Stable Oct 6, 2025