Updated: 13 November 2026 · Applies to: DirectAdmin (Evolution skin), MariaDB and MySQL
Open MySQL Management, click the database, then in Database Operations click Optimize to reclaim space and defragment a table after many rows were deleted, or Analyze (sometimes shown as Check) to refresh the statistics MySQL uses when it decides how to run a query.
Steps
- Log in to DirectAdmin (usually
https://your-server:2222; the address is in your welcome email). - Open User Level > MySQL Management and click the database.
- In Database Operations, click Optimize, Check or Analyze, depending on which maintenance you need.
What each one actually does
- Optimize rebuilds a table's storage to remove the gaps left by deleted or updated rows, which can shrink the file and speed up full-table scans. On a MyISAM or Aria table it defragments the file directly. On an InnoDB table, tested on MariaDB 11.4,
OPTIMIZE TABLEreports "Table does not support optimize, doing recreate + analyze instead": MariaDB rebuilds the table and refreshes its statistics as the nearest equivalent, since InnoDB does not store rows the same way MyISAM does. - Analyze recalculates the key distribution statistics the query optimiser uses, without rewriting the table's data. Run it after a big change in row count (a large import, a bulk delete) so the optimiser's query plans stay accurate; it is much faster than Optimize because it does not rebuild the table.
- Check scans the table for structural errors and reports whether it is healthy, without changing anything. Treat a result other than "OK" as a sign to run Repair next.
When to run which
Run Analyze regularly on tables that change a lot (an orders table, a sessions table); it is cheap and keeps query plans sensible. Run Optimize only occasionally, and only on tables that have had a lot of rows deleted or updated, since it locks the table while it rewrites the storage file. Run Check if an application reports odd query results or slow queries you cannot otherwise explain.
Tables are locked while they run
Optimize in particular locks the table for reads and writes until it finishes, which can take a while on a large table. Run it at a quiet time on a busy site, not during peak traffic, and expect the application to show errors or time out for visitors until the operation completes.
From the command line instead of the panel, the same operations are plain SQL: OPTIMIZE TABLE, ANALYZE TABLE and CHECK TABLE; see auto repairing a MySQL database table with a command for the command-line equivalent of Repair. User privileges on the same database are covered in modifying user privileges for a database in DirectAdmin.
Official documentation: MariaDB OPTIMIZE TABLE.