Purpose: As years pass by, the database size increases and you would like to delete unwanted records especially workflow history. This document explains you how to delete workflow history.
To delete the workflow history, execute the below scripts:
from wftransaction
where wfid not in
(
select wfid
from wfinstance
where active = 1
)
and transdate <= (current timestamp - 1 month)
and memo is null;
commit;
delete
from wfcallstack
where wfid in
(
select wt.wfid
from wftransaction wt
,wfinstance wi
where wt.wfid = wi.wfid
and wi.active = 0
and transdate <= (current timestamp - 1 month)
and memo is null
);
commit;
delete
from wfassignment
where wfid in
(
select wt.wfid
from wftransaction wt
,wfinstance wi
where wt.wfid = wi.wfid
and wi.active = 0
and transdate <= (current timestamp - 1 month)
and memo is null
);
commit;
delete
from wfinstance
where wfid in
(
select wfid
from wftransaction
where memo is null
and transdate <= (current timestamp - 1 month)
)
and active = 0;
commit;
delete
from logintracking
where attemptdate <= (current timestamp - 3 month);
commit;
Thank you for your very useful information, and much needed blog, Madhav. Have you any idea about how to make the workflow history friendlier? Currently, it shows a lot of irrelevant information for an end user like routing decisions and conditional results made by the application. Thanks, again.
ReplyDeleteSorry for the late reply. I suggest to restrict the workflow history to display actions like approve, cancel and reroute. However, restricting the actions will make it hard for debugging any issues. You can still use conditional UI to restrict the actions for end users and display all actions for maximo administrators. Let me know, if I could help you any more on this.
ReplyDeletevery good post.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletewhen the first delete statement has been executed, how can we execute the next statement since the reference to wftransaction.wfid has been lost?
ReplyDeleteI tried this, and I found the number of record deleted in the next delete statement was not same as before we delete it.