...
Code Block |
---|
language | sql |
---|
title | MySQL, MSSQL, Oracle |
---|
|
select count(*) from SHKXPDLS |
...
Code Block |
---|
language | sql |
---|
title | MySQL, MSSQL |
---|
|
select count(*) from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, packageVersion from app_package
) as used_processes group by packageId, packageVersion
); |
If you would like to list the process versions, you can use the following query.
Code Block |
---|
language | sql |
---|
title | MySQL, MSSQLOracle |
---|
|
select count(*) from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, TO_CHAR(packageVersion) from app_package
) as used_processes group by packageId, packageVersion
); |
3. Delete completed process instances data to clean up more XPDLs from cache
...
If you would like to list the process versions, you can use the following query.
Code Block |
---|
language | sql |
---|
title | MySQL, MSSQL |
---|
|
select * from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, packageVersion from app_package
) as used_processes group by packageId, packageVersion
); |
Code Block |
---|
|
select * from SHKXPDLS x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, TO_CHAR(packageVersion) from app_package
) group by packageId, packageVersion
); |
3. Delete completed process instances data to clean up more XPDLs from cache
If the process instances data are not important to you or you have your process instance data captured a copy by the Process Data Collector plugin, you can delete your process instances data to increase the number of unused XPDLs. In this case, only the process version for running process instances and the latest process version for each app version will be kept.
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete sp, spr, spd, sac, sad, sa
from SHKProcesses sp
join SHKProcessRequesters spr on spr.Id = sp.ID
left join SHKProcessData spd on spd.Process = sp.oid
left join SHKActivities sac on sac.ProcessId = sp.ID
left join SHKActivityData sad on sad.Activity = sac.oid
left join SHKAssignmentsTable sa on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010);
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
Code Block |
---|
|
delete (select sa.* from SHKAssignmentsTable sa
left join SHKProcesses sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select sad.* from SHKActivityData sad
left join SHKActivities sac on sad.Activity = sac.oid
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select sac.* from SHKActivities sac
left join SHKProcesses sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spd.* from SHKProcessData spd
left join SHKProcesses sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete (select spr.* from SHKProcessRequesters spr
left join SHKProcesses sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010));
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010); |
If you would like to clean the all the process instances data including the running process instances, you can use the following query.
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete from SHKAssignmentsTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
language | sql |
---|
title | MySQLMSSQL |
---|
|
SETEXEC FOREIGN_KEY_CHECKS=0;
delete sp, spr, spd, sac, sad, sa
from SHKProcesses sp
join SHKProcessRequesters spr on spr.Id = sp.ID
left join SHKProcessData spd on spd.Process = sp.oid
left join SHKActivities sac on sac.ProcessId = sp.ID
left join SHKActivityData sad on sad.Activity = sac.oid
left join SHKAssignmentsTable sa on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete sa from SHKAssignmentsTable as sa
left join SHKProcesses as sp on sa.ActivityProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sad from SHKActivityData as sad
left join SHKActivities as sac on sad.Activity = sac.oid
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete sac from SHKActivities as sac
left join SHKProcesses as sp on sac.ProcessId = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spd from SHKProcessData as spd
left join SHKProcesses as sp on spd.Process = sp.oid
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete spr from SHKProcessRequesters as spr
left join SHKProcesses as sp on spr.Id = sp.ID
where (sp.State = 1000006 or sp.State = 1000008 or sp.State = 1000010);
delete from SHKProcesses where (State = 1000006 or State = 1000008 or State = 1000010);
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
If you would like to clean the all the process instances data including the running process instances, you can use the following query.
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete from SHKAssignmentsTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete from SHKAssignmentsTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
4. Delete the unused XDPLs
Now, you can delete the unused XPDLs and it will be free from your memory cache when next server startup.
sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete from SHKAssignmentsTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses;
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all" |
Code Block |
---|
|
delete from SHKAssignmentsTable;
delete from SHKDeadlines;
delete from SHKActivityData;
delete from SHKActivities;
delete from SHKProcessData;
delete from SHKProcessRequesters;
delete from SHKProcesses; |
4. Delete the unused XDPLs
Now, you can delete the unused XPDLs and it will be free from your memory cache when next server startup.
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete x, xd from SHKXPDLS x join SHKXPDLData xd on x.oid= xd.XPDL
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, packageVersion from app_package
) as used_processes group by packageId, packageVersion
);
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
delete xd from SHKXPDLData as xd
left join SHKXPDLS as x on x.oid= xd.XPDL
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, packageVersion from app_package
) as used_processes group by packageId, packageVersion
);
delete x from SHKXPDLS as x |
Code Block |
---|
|
SET FOREIGN_KEY_CHECKS=0;
delete x, xd from SHKXPDLS x join SHKXPDLData xd on x.oid= xd.XPDL
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, def.ProcessDefinitionVersion as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, packageVersion from app_package
) as used_processes group by packageId, packageVersion
);
SET FOREIGN_KEY_CHECKS=1; |
Code Block |
---|
|
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK NOCHECKCHECK CONSTRAINT all"
|
Code Block |
---|
|
delete (select xd.* from SHKXPDLData as xd
left join SHKXPDLS as x on x.oid= xd.XPDL
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, TO_CHAR(packageVersion) from app_package
) as used_processes group by packageId, packageVersion
));
delete (select x.* from SHKXPDLS as x
where concat(x.XPDLId, x.XPDLVersion) not in (
select concat(packageId,packageVersion) as id from (
select def.PackageId as packageId, TO_CHAR(def.ProcessDefinitionVersion) as packageVersion
from SHKActivities act
join SHKProcesses pro on act.Process = pro.oid
left join SHKProcessDefinitions def on pro.ProcessDefinition = def.oid
group by def.PackageId, def.ProcessDefinitionVersion
union
select packageId, TO_CHAR(packageVersion) from app_package
) as used_processes group by packageId, packageVersion
));
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"
|
...