[Solved] The large size of the `telescope_entries.ibd` file in Laravel project

June 07, 2025

[Solved] The large size of the `telescope_entries.ibd` file in Laravel project

The large size of the telescope_entries.ibd file in Laravel project is due to how MySQL's InnoDB storage engine handles space after deleting entries. When you run php artisan telescope:clear, the entries in the telescope_entries table are deleted, but the .ibd file (which stores the table data) does not shrink automatically and continues to occupy a large amount of disk space. This is because InnoDB marks the space as free internally but does not release it back to the filesystem[1][5].

To address this, you can:

  • Run a manual optimization on the table after clearing entries using the SQL command:

    OPTIMIZE TABLE telescope_entries;
    

    This will reclaim disk space by reorganizing the table storage[1][5].

  • Use the laravel-telescope-flusher package, which improves on the default clearing by truncating the table (which is faster and resets the storage) and then running OPTIMIZE TABLE to release disk space. This approach avoids the performance bottlenecks of deleting large numbers of rows and effectively reduces the .ibd file size[5].

  • Consider pruning entries regularly with php artisan telescope:prune to avoid the table growing too large. However, pruning large tables can be slow and may time out, so chunked deletes or truncation followed by optimization is preferable for very large tables[4][5].

Additionally, you can limit the amount of data Telescope records by configuring filters in TelescopeServiceProvider to record only necessary entries, reducing database growth[3][6].

In summary, the large .ibd file size is normal after deleting entries due to InnoDB's storage behavior. Running OPTIMIZE TABLE after clearing or using packages like laravel-telescope-flusher can effectively reduce the file size and improve performance. Regular pruning and filtering Telescope data also help manage database size.

[1] https://github.com/laravel/telescope/issues/837 [2] https://laracasts.com/discuss/channels/laravel/laravel-telescope-entries [3] https://stackoverflow.com/questions/64554173/how-to-limit-the-telescope-entries-in-laravel [4] https://github.com/laravel/telescope/issues/536 [5] https://dev.to/tegos/efficiently-managing-telescope-entries-with-laravel-telescope-flusher-484a [6] https://laravel.com/docs/12.x/telescope [7] https://laracasts.com/discuss/channels/code-review/migration-fails-due-to-telescope-entries-table [8] https://www.toptal.com/laravel/handling-intensive-tasks-with-laravel