From fb0cdb12e7be17260117948dbca127ec09715392 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 27 Aug 2017 11:55:25 +0200 Subject: [PATCH] IDEMPIERE-3396 Performance Issue in Process' Saved Parameter --- .../oracle/201708271154_IDEMPIERE-3396.sql | 35 +++++++++++++++++++ .../201708271154_IDEMPIERE-3396.sql | 32 +++++++++++++++++ .../src/org/compiere/model/MPInstance.java | 1 + 3 files changed, 68 insertions(+) create mode 100644 migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql create mode 100644 migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql diff --git a/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql b/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql new file mode 100644 index 0000000000..6ae0594afc --- /dev/null +++ b/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql @@ -0,0 +1,35 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3396 +-- Aug 27, 2017 11:52:21 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201059,'6a6f51d9-b636-48f8-ae98-33204895c8f4',TO_DATE('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_last_ix',TO_DATE('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,282,'N','N','N','N','N') +; + +-- Aug 27, 2017 11:52:37 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201347,'c9cc1891-e41b-4d3e-8c36-f746e5b0fe39',TO_DATE('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,5951,201059,1) +; + +-- Aug 27, 2017 11:52:45 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201348,'7b63fe78-7d25-49a8-a64c-1ab5b9fa90d1',TO_DATE('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,2781,201059,2) +; + +-- Aug 27, 2017 11:53:49 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201349,'50e5ad46-685a-470b-a42c-239f2a104246',TO_DATE('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,8221,201059,3) +; + +-- Aug 27, 2017 11:53:56 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201350,'f65ee789-904b-433f-b4c9-bbc1fde9ca8a',TO_DATE('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,8225,201059,4) +; + +-- Aug 27, 2017 11:54:02 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201351,'1875c8e6-f900-4486-8c22-b6bda65e751a',TO_DATE('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,210890,201059,5) +; + +-- Aug 27, 2017 11:54:08 AM CEST +CREATE INDEX ad_pinstance_last_ix ON AD_PInstance (AD_User_ID,AD_Process_ID,AD_Client_ID,IsActive,Name) +; + +SELECT register_migration_script('201708271154_IDEMPIERE-3396.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql b/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql new file mode 100644 index 0000000000..747fc23e45 --- /dev/null +++ b/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql @@ -0,0 +1,32 @@ +-- IDEMPIERE-3396 +-- Aug 27, 2017 11:52:21 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201059,'6a6f51d9-b636-48f8-ae98-33204895c8f4',TO_TIMESTAMP('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_last_ix',TO_TIMESTAMP('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,282,'N','N','N','N','N') +; + +-- Aug 27, 2017 11:52:37 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201347,'c9cc1891-e41b-4d3e-8c36-f746e5b0fe39',TO_TIMESTAMP('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,5951,201059,1) +; + +-- Aug 27, 2017 11:52:45 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201348,'7b63fe78-7d25-49a8-a64c-1ab5b9fa90d1',TO_TIMESTAMP('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,2781,201059,2) +; + +-- Aug 27, 2017 11:53:49 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201349,'50e5ad46-685a-470b-a42c-239f2a104246',TO_TIMESTAMP('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,8221,201059,3) +; + +-- Aug 27, 2017 11:53:56 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201350,'f65ee789-904b-433f-b4c9-bbc1fde9ca8a',TO_TIMESTAMP('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,8225,201059,4) +; + +-- Aug 27, 2017 11:54:02 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201351,'1875c8e6-f900-4486-8c22-b6bda65e751a',TO_TIMESTAMP('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,210890,201059,5) +; + +-- Aug 27, 2017 11:54:08 AM CEST +CREATE INDEX ad_pinstance_last_ix ON AD_PInstance (AD_User_ID,AD_Process_ID,AD_Client_ID,IsActive,Name) +; + +SELECT register_migration_script('201708271154_IDEMPIERE-3396.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MPInstance.java b/org.adempiere.base/src/org/compiere/model/MPInstance.java index 1c215ce208..45c81d03ad 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstance.java @@ -406,6 +406,7 @@ public class MPInstance extends X_AD_PInstance int cnt = 0; try { pstmt = DB.prepareStatement(sql, null); + pstmt.setFetchSize(lastRunCount); pstmt.setInt(1, AD_Process_ID); pstmt.setInt(2, AD_User_ID); pstmt.setInt(3, Env.getAD_Client_ID(ctx));