Skip to content

Instantly share code, notes, and snippets.

@yregaieg
Forked from AFaust/cleanupAlfrescoHistAct.sql
Created November 30, 2016 16:03
Show Gist options
  • Save yregaieg/817ccf9f7421140e0e408215814fbe49 to your computer and use it in GitHub Desktop.
Save yregaieg/817ccf9f7421140e0e408215814fbe49 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