PHPackages                             gigerit/laravel-mysql-optimizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. gigerit/laravel-mysql-optimizer

ActiveLibrary[Database &amp; ORM](/categories/database)

gigerit/laravel-mysql-optimizer
===============================

A laravel package that optimizes mysql/mariadb database tables.

v1.5.1(1mo ago)2914MITPHPPHP ^8.2CI passing

Since May 27Pushed 1mo agoCompare

[ Source](https://github.com/gigerIT/laravel-mysql-optimize)[ Packagist](https://packagist.org/packages/gigerit/laravel-mysql-optimizer)[ RSS](/packages/gigerit-laravel-mysql-optimizer/feed)WikiDiscussions main Synced today

READMEChangelog (9)Dependencies (20)Versions (15)Used By (0)

MySQL Optimizer
===============

[](#mysql-optimizer)

A Laravel package for optimizing MySQL/MariaDB database tables with support for both synchronous and queued execution.

Why use this package?
---------------------

[](#why-use-this-package)

MySQL's `OPTIMIZE TABLE` statement reorganizes tables and compacts wasted space, resulting in:

- **Faster queries** through improved data packing and reduced fragmentation
- **Less disk I/O** for full table scans
- **Reduced storage footprint** via better space utilization

Ideal for tables with frequent `INSERT`, `UPDATE`, and `DELETE` operations.

Requirements
------------

[](#requirements)

- Laravel 8.x – 12.x (auto-discovered service provider)
- MySQL 5.7+/8.0+ or MariaDB (uses INFORMATION\_SCHEMA and OPTIMIZE TABLE)

Installation
------------

[](#installation)

```
composer require gigerit/laravel-mysql-optimizer
```

Publish the configuration (optional):

```
php artisan vendor:publish --provider="MySQLOptimizer\ServiceProvider"
```

Configuration
-------------

[](#configuration)

The package reads the default database to optimize from `config/mysql-optimizer.php`:

```
