Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

DB Optimize

Security covered Under active development 48 sites

This module helps improve database performance by optimizing your database tables. It offers a simple interface, cron integration, and a Drush command to manually or automatically run SQL OPTIMIZE TABLE operations on selected or all tables.

DB Optimize

DbOptimize is a lightweight utility module that helps Drupal site administrators and developers keep their database tables optimized for better performance. It provides a simple UI and Cron integration to run SQL OPTIMIZE TABLE operations, along with a Drush command for quick CLI usage.

Key Features

  • ✅ Simple admin UI to configure and run database table optimizations.
  • ✅ Supports manual optimization through the admin interface.
  • ✅ Supports automatic optimization via Drupal Cron.
  • ✅ Supports CLI optimization via a Drush command.
  • ✅ Specify exactly which tables to optimize, or leave blank to optimize all tables.
  • ✅ Logs optimization actions in Drupal's system log (dblog).
  • ✅ Safe error handling with clear reporting.
  • ✅ Built following Drupal's coding standards and best practices.

Use Cases

  • Improve database performance on busy sites where tables like cache_*, watchdog, and sessions grow quickly.
  • Automate database maintenance on production and staging environments.
  • Perform quick table optimizations via Drush without accessing the database directly.
  • Keep your site's database healthy as part of regular maintenance workflows.

Installation & Usage

Install the module using Composer or place it in your contrib directory:

composer require drupal/dboptimize

Enable the module:

drush en dboptimize

Go to Configuration → System→ DB Optimize (/admin/config/system/dboptimize) to:

Add the tables you want to optimize (leave blank to optimize all).

Manually trigger the optimization.

View optimization results in the Recent Log Messages (/admin/reports/dblog).

Configure Cron to run optimizations automatically as needed.

Cron Integration

During Cron runs:

  • If table names are configured, only those tables will be optimized.
  • If no tables are configured, all database tables will be optimized.

Drush Command

Optimize your database directly from the CLI:

drush dboptimize:optimize
drush dboptimize:optimize --tables=cache_data,watchdog
drush dboptimize:analyze
drush dboptimize:analyze --tables=cache_data,watchdog
drush dboptimize:check
drush dboptimize:check --tables=cache_data,watchdog
drush dbo-repair
drush dbo-repair --tables=cache_data,watchdog

Compatibility

  • ✅ Fully compatible with Drupal 9 ,10 and 11.
  • ✅ Tested on MySQL and MariaDB.
  • ❌ PostgreSQL support is not implemented yet (pull requests welcome!).
Drupal 9–11

Ask your assistant about DB Optimize

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
15
Tracked since
Jul 2025
Latest release
3 months ago
Releases (12 mo)
5 ▼ from 10
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.5 Stable 9–11 Sep 10, 2025
1.0.3 Stable 10–11 Aug 30, 2025
1.0.2 Stable 10 Aug 29, 2025
1.0.1 Stable 10 Jul 7, 2025
1.0.0 Stable 10 Jul 7, 2025