Skip to content

Instantly share code, notes, and snippets.

@AFaust
Last active January 15, 2017 05:44
Show Gist options
  • Save AFaust/4afeda535f3acd18f7fa8674ae5b2c5d to your computer and use it in GitHub Desktop.
Save AFaust/4afeda535f3acd18f7fa8674ae5b2c5d to your computer and use it in GitHub Desktop.
Delete all historic process instances and related historic data for workflows completed before a specific date (MySQL / MariaDB)
delete from act_hi_actinst where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_attachment where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_comment where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_detail where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_identitylink where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_varinst where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_taskinst where proc_inst_id_ in (select id_ from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24');
delete from act_hi_procinst where end_time_ is not null and end_time_ < timestamp '2016-11-24';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment