delete old aow_processed and aow_processed_aow_actions records

Hi, i have 4 active workflows; each of them have thousands of processed audit records,…
Is there a way to schedule the delete of oldest?

I found my db was increasing rapidly… (+200MB in a few days)

I looked further into my db and i see thanks to this query:

SELECT table_name, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{MY-DB-NAME}' ORDER BY `TABLES`.`TABLE_ROWS` DESC

that i have too many records here:

One of my workflow actually has 866797 records,…

1 Like

In addiction i can say that i set

Repeat Execution
Repeat on All Records

I understand that every time the scheduler is running (every 5 minutes) all records of my module (Calls) are involved.

What i wanted was to start an action every time a Call’s date start is changed.

Maybe i fixed it adding the condition: Calls > Date Start > Equal to > Any Change.

Anyway is there a way to schedule the delete of oldest records?

Interesting, I agree with your point. Their is one scheduler Prune Database on 1st of Month which removed all the data which are deleted. However your concerns are different. May be you can create a separate scheduler to delete the old aow_processed and actions.

Ok UrdhvaTech,

i created a php script to schedule it to delete records older than one month:


<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
require_once('include/entryPoint.php');
$db = DBManagerFactory::getInstance();
$onemonthback = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m")-1, date("d"),   date("Y")));
$sql = "DELETE FROM `aow_processed` WHERE date_entered <'".$onemonthback."'";
$result = $db->query($sql);
echo "result=".$result."</BR>";
$sql2 = "DELETE FROM `aow_processed_aow_actions` WHERE date_modified <'".$onemonthback."'";
$result2 = $db->query($sql2);
echo "result=".$result2."</BR>";
?>

What do you think about it?

Hi mayerelyashiv,

Their is already a schedular job which removed the record that are in deleted. You just have to set the frequency of execution, weekly, monthly etc.
What i was not sure was whether it removes record of aow_processed or aow_processed_aow_actions.

You may check that cron. Let me know what works the best.