DB Tables emails and emails_text safe to empty

I have a workflow process that emails out to users when a new lead/opportunity is assigned to them along with other notifications.

The emails_text table is getting huge. I have no need to save these emails.
Is it safe to empty the two tables emails and emails_text?

No other email accounts are used, just an outgoing account. When I go into Emails, it does not show the outgoing account.

Thanks.

You can delete from the DB but you need to be careful not to leave any “hanging threads”.

Start by understanding the relationships between the tables.

This is how I’d do it. I would go in emails_text table and choose a row that I want to delete. Take a note of the row’s id field.

Now, in phpMyAdmin,

  • choose the database (not a single table, select the whole database) and
  • choose Search from the top menu.
  • type the id in the search box
  • in the box with all the table names, select all of them (click the first one and press ctrl-shift-end)
  • press the “Go” button to search

This will let you see where that id is referenced in the database. You will probably find a entry in the emails table. I think you should grab the row id of that one, and repeat the process, to find out which beans are related to that email.

You can automate all this in SQL statements.

It won’t be tragic if you leave a few relationships hanging around, pointing to email records that no longer exist. In fact, SuiteCRM systems typically have tons of these left-overs. but if it’s a lot of stuff you might want to keep things tidy.

Thank you for the response.

I did as you suggested and there were 3 other tables that emails_text was tied to.
I backed up the tables, emptied the tables, and crossed my fingers and so far all is good.

It is a crazy number of records that one email creates, even though they are in many tables. (If that makes sense.)

Thanks again @pgr I always appreciate your help.

1 Like