Workflow caused database to grow out of control

I added a custom field to invoices and created a workflow to update all those fields that are empty. I set the workflow to run on all records continuously. This caused the aow_processed table to grow to 2.7Gigs and the aow_processed_aow_actions table grew to 1.8 Gigs, now my server is full and I’m really stuck on what to do about it. I have deleted the workflow that was causing this and disables most schedulers, but now I can’t backup my database as my server is full. is there a way to clean of those tables?

My SuiteCRM is version 7.10.31 Sugar Version 6.5.25 (Build 344).
I’m running it on Nginx on Ubunto Server 20.04.3 LTS (GNU/Linux 5.4.0-84-generic x86_64)

And I don’t have Phpmyadmin installed ( could not get it to work when I installed Nginx ).

HI Daniel4

Do you have experience running SQL commands at the command line?

If not… you’d probably be better finding some help in your company to do it.

Have you done a select count(*) query in mySQL command line -to find how many records each of the Invoice tables are?

Also - do you know the tables behind the scenes for Invoices and associated fields?

What to do next:

  1. First rule - take a database backup. It will be slower than you;d like because of the bulk - but it;s always safest advice.

  2. it’s a long shot - but maybe the Tables are full of records that SuiteCRM has deleted (ie WHERE deleted=1).

Run a select count(*) as above, with and without deleted=1 added and find out.

If so -a DELETE query against deleted=1 records is easy.

    • your workflow was intended to ‘update a field’ - is the value that it would update to: something that you could use in a SQL query to delete records.

Maybe that is unlikely -but if your workflow set that field to something that is unique -you can run a DELETE query with that as where clause.

  1. Could you identify the records to delete by date/time: eg - if it was running all night when no users were logged in; then date_modified will be “middle of the night” ? (actually, I am not 100% sure right this moment if Workflow changes DO change then date_modified field, or not: so this may not help)

In aow_processed database table, it is safe to delete all rows relative to a Workflow, if that Workflow no longer exists.

Something like this:

delete * from aow_workflow 
where aow_workflow_id = "aaaaa-bbb-cccc-ddddd"

If you are sure that it refers to a non-existent (or marked as deleted) workflow on the table aow_workflow

On the other hand, if the workflow exists and is active, deleting those rows would cause the Workflow to become amnesiac. It would no longer remember what it had tracked regarding the “no repeated runs” for each record. This could have terrible consequences or none at all, depending on your business case (what you’re doing with those records and with that Workflow).

Hi pgr - your suggestion is better than mine -I’d overlooked that Daniel4 knew exactly which specific tables were huge.

1 Like

Thanks @pgr and @DJuser, I will have a look this weekend and will let you guys know what works.

Thanks @pgr, that worked, I changed the workflow to only run on save instead of allways and then proceeded to delete all entries with that workflow id ( DELETE FROM aow_processed WHERE aow_workflow_id = ‘aaaaa-bbb-cccc-ddddd’; ), now that tables size is back to normal. Now I want to clean up aow_processed_aow_actions table so i had a look at its structure and I’m not sure what it is used for and how, so I don’t want to touch it until I am sure it wont break anything, any suggestions would be highly appreciated.

Maybe this will help you:

https://schema--suitecrm-docs.netlify.app/schema/tables/aow_processed_aow_actions