For the most part, database on Servd are very stable and reliable. But in very rare circumstances, we've seen performance issues and data corruption due to niche bugs in MariaDB. We aim to always keep our databases up-to-date to get the latest bug patches, but unfortunately it's almost impossible to avoid them happening entirely.
For situations where database issues do occur, we've added a "Repair Database" feature that will rebuild MariaDB's indexes and metadata to restore normal service. It isn't a silver bullet and won't fix all database-related issues, but can in some circumstances.
⚠️ Note: running a database repair requires a lock on each table. If you're experiencing high traffic, this may cause an interruption until the repair completes.
Repair All Tables
To trigger a full database repair, do the following:
Navigate to the "Repair Database" section in your project's Troubleshooting page
Click the "Repair Database" button.
A repair task will now be triggered. It should take a few minutes depending on the size of the database and the amount of traffic your project is currently receiving.
Repair A Specific Table
If you're just looking to repair a specific table and want to minimise the impact of the repairing it, try doing the following:
Run the following SQL statement:
OPTIMIZE TABLE <table name>;
(this will output "Table does not support optimize, doing recreate + analyze instead" - that's expected).
Once it's finished running, the corruption should be cleared and queries against the table should go through fine again.