From 6c49a4f784f0bf48bcc560899b32abc344377683 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:08:34 +0530 Subject: [PATCH] [incubator-kie-issues#1049] Add index to ProcessInstanceLog table to improve LogCleanupCommand performance (#2432) (#2434) * [incubator-kie-issues#1049] Add index to ProcessInstanceLog table to improve LogCleanupCommand performance * Omit new index in H2 as it lacks support for filtered index Co-authored-by: Martin Weiler --- .../src/main/resources/db/ddl-scripts/db2/db2-jbpm-schema.sql | 1 + .../main/resources/db/ddl-scripts/derby/derby-jbpm-schema.sql | 1 + .../resources/db/ddl-scripts/hsqldb/hsqldb-jbpm-schema.sql | 1 + .../resources/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql | 3 ++- .../db/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql | 3 ++- .../resources/db/ddl-scripts/oracle/oracle-jbpm-schema.sql | 1 + .../db/ddl-scripts/postgresql/postgresql-bytea-jbpm-schema.sql | 1 + .../db/ddl-scripts/postgresql/postgresql-jbpm-schema.sql | 1 + .../db/ddl-scripts/sqlserver/sqlserver-jbpm-schema.sql | 1 + .../db/ddl-scripts/sqlserver2008/sqlserver2008-jbpm-schema.sql | 1 + .../resources/db/ddl-scripts/sybase/sybase-jbpm-schema.sql | 2 ++ .../db/upgrade-scripts/db2/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/derby/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/hsqldb/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/mysql5/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/mysqlinnodb/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/postgresql/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/sqlserver/rhpam-7.13.1-to-7.13.5.sql | 1 + .../upgrade-scripts/sqlserver2008/rhpam-7.13.1-to-7.13.5.sql | 1 + .../db/upgrade-scripts/sybase/rhpam-7.13.1-to-7.13.5.sql | 2 ++ 20 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/db2/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/derby/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/hsqldb/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysql5/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysqlinnodb/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/postgresql/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver2008/rhpam-7.13.1-to-7.13.5.sql create mode 100644 jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sybase/rhpam-7.13.1-to-7.13.5.sql diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/db2/db2-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/db2/db2-jbpm-schema.sql index f4c44aa025..a7320c23ce 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/db2/db2-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/db2/db2-jbpm-schema.sql @@ -875,6 +875,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/derby/derby-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/derby/derby-jbpm-schema.sql index f640e296b4..2c906c679e 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/derby/derby-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/derby/derby-jbpm-schema.sql @@ -809,6 +809,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/hsqldb/hsqldb-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/hsqldb/hsqldb-jbpm-schema.sql index 0f9fe6eec5..e5f86d82ea 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/hsqldb/hsqldb-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/hsqldb/hsqldb-jbpm-schema.sql @@ -811,6 +811,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql index f72c59f7b8..643b14cbd5 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysql5/mysql5-jbpm-schema.sql @@ -800,6 +800,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); @@ -837,4 +838,4 @@ create index IDX_CaseFileDataLog_caseId on CaseFileDataLog(caseId); create index IDX_CaseFileDataLog_itemName on CaseFileDataLog(itemName); - \ No newline at end of file + diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql index c28e98bc72..ba3c271c9a 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/mysqlinnodb/mysql-innodb-jbpm-schema.sql @@ -799,6 +799,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); @@ -837,4 +838,4 @@ create index IDX_CaseFileDataLog_itemName on CaseFileDataLog(itemName); - \ No newline at end of file + diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/oracle/oracle-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/oracle/oracle-jbpm-schema.sql index b0752a8ce5..656e42eb49 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/oracle/oracle-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/oracle/oracle-jbpm-schema.sql @@ -878,6 +878,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-bytea-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-bytea-jbpm-schema.sql index 2d70c77795..e7f2ba864c 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-bytea-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-bytea-jbpm-schema.sql @@ -154,6 +154,7 @@ create index IDX_PInstLog_parentPInstId on ProcessInstanceLog (parentProcessInst create index IDX_PInstLog_pId on ProcessInstanceLog (processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog (processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog (processInstanceId); +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog (processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog (processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog (start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-jbpm-schema.sql index 114b7f814a..3686227345 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/postgresql/postgresql-jbpm-schema.sql @@ -879,6 +879,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver/sqlserver-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver/sqlserver-jbpm-schema.sql index b5987c3b8a..2289c1296a 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver/sqlserver-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver/sqlserver-jbpm-schema.sql @@ -811,6 +811,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver2008/sqlserver2008-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver2008/sqlserver2008-jbpm-schema.sql index b1f8766120..b554d52996 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver2008/sqlserver2008-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sqlserver2008/sqlserver2008-jbpm-schema.sql @@ -811,6 +811,7 @@ create index IDX_PInstLog_pId on ProcessInstanceLog(processId); create index IDX_PInstLog_pInsteDescr on ProcessInstanceLog(processInstanceDescription); create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId); + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); create index IDX_PInstLog_pName on ProcessInstanceLog(processName); create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion); create index IDX_PInstLog_start_date on ProcessInstanceLog(start_date); diff --git a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sybase/sybase-jbpm-schema.sql b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sybase/sybase-jbpm-schema.sql index 78a034c7c1..c85dfae236 100644 --- a/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sybase/sybase-jbpm-schema.sql +++ b/jbpm-db-scripts/src/main/resources/db/ddl-scripts/sybase/sybase-jbpm-schema.sql @@ -983,6 +983,8 @@ go create index IDX_PInstLog_pInstId on ProcessInstanceLog(processInstanceId) go + create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4) + go create index IDX_PInstLog_pName on ProcessInstanceLog(processName) go create index IDX_PInstLog_pVersion on ProcessInstanceLog(processVersion) diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/db2/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/db2/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/db2/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/derby/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/derby/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/derby/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/hsqldb/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/hsqldb/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/hsqldb/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysql5/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysql5/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysql5/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysqlinnodb/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysqlinnodb/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/mysqlinnodb/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/postgresql/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/postgresql/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/postgresql/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver2008/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver2008/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..48d2d4e68e --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sqlserver2008/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4); diff --git a/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sybase/rhpam-7.13.1-to-7.13.5.sql b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sybase/rhpam-7.13.1-to-7.13.5.sql new file mode 100644 index 0000000000..1f013f933d --- /dev/null +++ b/jbpm-db-scripts/src/main/resources/db/upgrade-scripts/sybase/rhpam-7.13.1-to-7.13.5.sql @@ -0,0 +1,2 @@ +create index IDX_PInstLog_pInstId_status ON ProcessInstanceLog (processInstanceId, status) WHERE status IN (0,1,4) +go