From 42320dc9b99fec31382e9d85d450a7b1b84989bc Mon Sep 17 00:00:00 2001 From: jendib Date: Sat, 9 May 2015 18:00:03 +0200 Subject: [PATCH] #13: Fix performance issue --- .../main/java/com/sismics/docs/core/dao/jpa/DocumentDao.java | 3 +-- docs-core/src/main/resources/config.properties | 2 +- docs-core/src/main/resources/db/update/dbupdate-009-0.sql | 2 ++ docs-web/src/dev/resources/config.properties | 2 +- docs-web/src/prod/resources/config.properties | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 docs-core/src/main/resources/db/update/dbupdate-009-0.sql diff --git a/docs-core/src/main/java/com/sismics/docs/core/dao/jpa/DocumentDao.java b/docs-core/src/main/java/com/sismics/docs/core/dao/jpa/DocumentDao.java index be276d28..b6c1bb14 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/dao/jpa/DocumentDao.java +++ b/docs-core/src/main/java/com/sismics/docs/core/dao/jpa/DocumentDao.java @@ -157,8 +157,7 @@ public class DocumentDao { List criteriaList = new ArrayList(); StringBuilder sb = new StringBuilder("select distinct d.DOC_ID_C c0, d.DOC_TITLE_C c1, d.DOC_DESCRIPTION_C c2, d.DOC_CREATEDATE_D c3, d.DOC_LANGUAGE_C c4, "); - // TODO Optimize me sb.append(" (select count(s.SHA_ID_C) from T_SHARE s, T_ACL ac where ac.ACL_SOURCEID_C = d.DOC_ID_C and ac.ACL_TARGETID_C = s.SHA_ID_C and ac.ACL_DELETEDATE_D is null and s.SHA_DELETEDATE_D is null) c5, "); - sb.append(" 0 as c5, "); + sb.append(" (select count(s.SHA_ID_C) from T_SHARE s, T_ACL ac where ac.ACL_SOURCEID_C = d.DOC_ID_C and ac.ACL_TARGETID_C = s.SHA_ID_C and ac.ACL_DELETEDATE_D is null and s.SHA_DELETEDATE_D is null) c5, "); sb.append(" (select count(f.FIL_ID_C) from T_FILE f where f.FIL_DELETEDATE_D is null and f.FIL_IDDOC_C = d.DOC_ID_C) c6 "); sb.append(" from T_DOCUMENT d "); diff --git a/docs-core/src/main/resources/config.properties b/docs-core/src/main/resources/config.properties index fda5dfd0..edf8e6a4 100644 --- a/docs-core/src/main/resources/config.properties +++ b/docs-core/src/main/resources/config.properties @@ -1 +1 @@ -db.version=8 \ No newline at end of file +db.version=9 \ No newline at end of file diff --git a/docs-core/src/main/resources/db/update/dbupdate-009-0.sql b/docs-core/src/main/resources/db/update/dbupdate-009-0.sql new file mode 100644 index 00000000..cd34b316 --- /dev/null +++ b/docs-core/src/main/resources/db/update/dbupdate-009-0.sql @@ -0,0 +1,2 @@ +create index IDX_ACL_COMPOSITE on T_ACL (ACL_SOURCEID_C, ACL_TARGETID_C, ACL_PERM_C, ACL_DELETEDATE_D); +update T_CONFIG set CFG_VALUE_C='9' where CFG_ID_C='DB_VERSION'; \ No newline at end of file diff --git a/docs-web/src/dev/resources/config.properties b/docs-web/src/dev/resources/config.properties index 44ddb414..04b5153a 100644 --- a/docs-web/src/dev/resources/config.properties +++ b/docs-web/src/dev/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=8 \ No newline at end of file +db.version=9 \ No newline at end of file diff --git a/docs-web/src/prod/resources/config.properties b/docs-web/src/prod/resources/config.properties index 44ddb414..04b5153a 100644 --- a/docs-web/src/prod/resources/config.properties +++ b/docs-web/src/prod/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=8 \ No newline at end of file +db.version=9 \ No newline at end of file