SuiteCRM stores nearly everything in MySQL/MariaDB: leads, contacts, opportunities, audit trails, scheduler history, email bodies, and the module metadata that drives the entire application. Because the Sugar-derived schema uses a soft-delete model and keeps extensive change tracking, the database grows far faster than most administrators expect. A CRM that feels snappy at launch can become sluggish within a year as tables fill with deleted-but-retained rows, orphaned relationship records, and audit entries that no one will ever read. On shared hosting you cannot tune server-wide MySQL variables or run command-line maintenance, but almost every meaningful repair happens at the schema and application level, which is fully reachable through phpMyAdmin and the SuiteCRM Admin panel.
This walkthrough explains where the bloat originates, how to measure it accurately, and how to clean, repair, and index the database using only your hosting account tools.
Where SuiteCRM Database Bloat Actually Comes From
The single biggest contributor is the soft-delete pattern. When a user deletes a contact, account, or case, SuiteCRM does not remove the row. It sets deleted = 1 and leaves the record in place so relationships and audit history stay intact. Over time a contacts or leads table can be half full of rows the interface never displays. Every list-view query still scans those rows because the deleted column is part of nearly every WHERE clause.
The second contributor is auditing. Any module with auditing enabled writes a row to its companion *_audited table on every field change. The cases_audit, accounts_audit, and opportunities_audit tables frequently become the largest objects in the database. Alongside these, the tracker table logs user navigation for the "Recently Viewed" and "Last Viewed" features and grows without bound unless the scheduler prunes it.
Relationship tables add a third layer. Join tables such as accounts_contacts, securitygroups_records, and the numerous *_rel tables accumulate their own soft-deleted rows. Finally, the job_queue table (scheduler execution history), email_cache, emails_text, and inbound_email bodies can swell dramatically if you use the email client or run frequent scheduled jobs.
Start by measuring rather than guessing. In DirectAdmin open phpMyAdmin, select your SuiteCRM database, and run a size query against the information schema for your own schema name:
SELECT table_name,
table_rows,
ROUND((data_length + index_length)/1024/1024, 2) AS size_mb,
ROUND(data_free/1024/1024, 2) AS free_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY (data_length + index_length) DESC
LIMIT 25;The free_mb column shows fragmentation — space allocated but not in use after deletions. A table with hundreds of megabytes of data_free is a strong candidate for optimization. To confirm how much is soft-deleted dead weight, check a specific table:
SELECT deleted, COUNT(*) FROM contacts GROUP BY deleted;If the deleted count rivals the live count, the cleanup steps below will reclaim real space and speed up every list view.
Cleaning Bloat and Pruning History Safely
Before touching data, take a full export. In phpMyAdmin select the database, choose the Export tab, pick Custom, enable Add DROP TABLE, and save a compressed SQL dump to your machine. You can also use DirectAdmin's Backup/Restore or Create/Restore Backups feature to snapshot the account first. Never purge soft-deleted rows without a current backup, because relationship integrity can break if you delete parent rows while child relationship rows remain.
The safest bloat reducer is the built-in repair and rebuild tooling, not manual DELETE statements. Log in as an administrator and open Admin → Repair (reachable at index.php?module=Administration&action=index, then the Repair link). The two actions that matter for maintenance are Quick Repair and Rebuild, which resynchronises the schema against the vardefs, and Remove Deleted Relationships, which permanently clears soft-deleted rows from relationship tables after you confirm. This is the supported way to remove deleted = 1 join records without risking orphaned links.
For history tables that the application is designed to prune, use the scheduler rather than hand-deleting. Under Admin → Scheduler the Prune Database on 1st of Month job trims tracker and related logging tables. Confirm it is active and that your cron is firing it. If tracker rows have already run into the millions, you can safely truncate that table directly, since it only backs the "Recently Viewed" widget:
TRUNCATE TABLE tracker;The job_queue table is similar — it records scheduler runs and can be pruned of old completed jobs without harm:
DELETE FROM job_queue
WHERE status = 'done'
AND date_entered < (NOW() - INTERVAL 30 DAY);Audit tables need judgement. If compliance does not require full change history, you can trim old entries from a specific audit table, for example:
DELETE FROM accounts_audit
WHERE date_created < (NOW() - INTERVAL 180 DAY);To stop audit tables regrowing, open Admin → Studio, select the module, open its fields, and disable the Audit checkbox on fields you do not need to track. After large deletions, reclaim the freed space by selecting the affected tables in phpMyAdmin, then choosing Optimize table from the With selected dropdown. On shared hosting this runs within your account's resource limits, so optimize a few large tables at a time rather than the whole database at once.
Repairing Broken Tables and Restoring Indexes
Crashed tables and "table marked as crashed" errors appear after an interrupted write, which on shared hosting usually means your account hit a CPU or memory limit mid-query. In phpMyAdmin, tick the suspect table, open the With selected menu, and run Check table followed by Repair table. These map to MySQL's CHECK and REPAIR operations and require no elevated privileges. For InnoDB tables, the Repair option may report that it is not supported; in that case run a dump-and-reimport of just that table through the Export/Import tabs, which rebuilds it cleanly.
Missing or damaged indexes are a frequent cause of slow list views. SuiteCRM defines its indexes in each module's vardefs, and the Quick Repair and Rebuild tool compares those definitions to the live schema. When indexes are missing it generates the ALTER TABLE statements and prints them at the bottom of the Repair page under a Differences Found notice with an Execute button. Review the SQL, then let the tool apply it — this is the correct way to restore the expected index layout rather than crafting indexes by hand.
To find genuinely slow queries without server logs, reproduce the slow page (a heavy list view or report) and inspect the query with EXPLAIN in phpMyAdmin. Paste the query the module runs, prefix it with EXPLAIN, and look for type: ALL (full table scan) and a high rows value. A scan on a large table with a deleted and date_modified filter signals a missing composite index. Confirm which indexes exist first:
SHOW INDEX FROM leads;If you must add a targeted index that vardefs do not provide, keep it conservative and aligned with real filters, for example a composite on the soft-delete flag plus the assigned user:
ALTER TABLE leads
ADD INDEX idx_leads_deleted_assigned (deleted, assigned_user_id);Connection errors such as "Database failure. Please refer to suitecrm.log" or "Too many connections" rarely mean the database is broken. On shared hosting they usually trace to the account's concurrent connection cap being exhausted by a runaway scheduler or a leftover import. Raise PHP's memory and execution headroom through a .user.ini in your document root so long maintenance pages finish before timing out:
memory_limit = 512M
max_execution_time = 300
mysqli.reconnect = OnThen open Admin → System Settings → Logger, set the log level to Fatal or Error for routine operation, and read suitecrm.log in your install root through File Manager to catch repeated query failures. Pairing that application log with the error_log file DirectAdmin writes in the same directory gives you both the SQL-level and PHP-level view needed to isolate the failing module before it corrupts a table again.