Memory seems ok.
You shouldn’t clear anything from the database without a lot of care, having full backups, and a full understanding of what the data means.
You can clear records with “deleted=1” that you know you won’t need.
You can also clear orphaned records, which are records related to other records that no longer exist (or exist, but have “deleted=1”). For example, a security_groups record of a Lead that you have deleted. Or a call related to a deleted Lead.
This is very common in SuiteCRM. To catch those, you need to devise clever SQL queries.
This might help:
And I have a few queries here in my notes, use at your own risk:
Delete orphaned records from contacts_cstm (you can make similar ones for other tables’ custom fields):
SELECT * -- DELETE ChildTable
FROM contacts_cstm ChildTable
LEFT JOIN contacts ParentTable
ON ChildTable.id_c = ParentTable.id
WHERE ParentTable.id IS NULL
SELECT record_id, module, s.deleted, c.last_name, c.deleted -- DELETE s
FROM securitygroups_records s
LEFT JOIN contacts c
ON s.record_id = c.id
WHERE c.id IS NULL
AND s.module='Contacts'
(make also a simpler delete of rows with s.deleted=1, where the relationship itself was deleted, but the record_id still exists)
My queries above are SELECT queries, so you can try running them just to see which rows they select. Then you can edit the first line, which has the DELETE command after the comment marker “–”. So SELECT * -- DELETE ChildTable
becomes DELETE ChildTable
to really make it delete the rows.
Did I mention you have to have full backups? 