UCP Call history slow to load

As a follow up. A support engineer helped by creating a script that we’ll run once a month that simply drops records older then two months, here it is for anyone else that’s running into the same problem and would like to implement the same solution:

#!/bin/bash

mysql -D asteriskcdrdb -e “DELETE FROM cdr WHERE calldate < DATE_SUB(NOW(), INTERVAL 2 MONTH);”
mysql -D asteriskcdrdb -e “DELETE FROM cel WHERE eventtime < DATE_SUB(NOW(), INTERVAL 2 MONTH);”
mysqlcheck --auto-repair --optimize --all-databases

If you are looking at this years from now keep in mind that the structure of the databases may have changed and that the above commands would need to be adapted to that.

1 Like