Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

DB Optimize

45 sites Security covered Drupal 9–11
View on drupal.org

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!).

Donation Support

This project took significant time to develop. If it has helped you save time in your work or business, feel free to contribute any amount you consider fair to support its continued development

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
1 month ago
Releases (12 mo)
11 ▲ from 4
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.2.2 Stable 9–11 Jul 4, 2026
1.2.1 Stable 9–11 Oct 19, 2025
1.2.0 Stable 9–11 Oct 18, 2025
1.1.1 Stable 9–11 Oct 16, 2025
1.1.0 Stable 9–11 Oct 16, 2025
1.0.9 Stable 9–11 Oct 15, 2025
1.0.8 Stable 9–11 Oct 14, 2025
1.0.7 Stable 9–11 Sep 24, 2025
1.0.x-dev Dev 9–11 Sep 24, 2025
1.0.6 Stable 9–11 Sep 10, 2025
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