← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2701: Added methods for manipulating indexes on the aggregated*value tables

 

------------------------------------------------------------
revno: 2701
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-21 12:06:16 +0100
message:
  Added methods for manipulating indexes on the aggregated*value tables
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-01-19 11:57:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueService.java	2011-01-21 11:06:16 +0000
@@ -135,7 +135,24 @@
      */
     public int countDataValuesAtLevel( OrganisationUnit orgunit, OrganisationUnitLevel level, Collection<Period> periods );
 
-
+    /**
+     * Creates indexes on the aggregateddatavalue and aggregatedindicatorvalue
+     * tables.
+     * 
+     * @param dataElement indicates whether to create an index on aggregateddatavalue.
+     * @param indicator indicates whether to create an index on aggregatedindicatorvalue.
+     */
+    void createIndex( boolean dataElement, boolean indicator );
+    
+    /**
+     * Drops the indexes on the aggregateddatavalue and aggregatedindicatorvalue
+     * tables.
+     * 
+     * @param dataElement indicates whether to drop the index on aggregateddatavalue.
+     * @param indicator indicates whether to drop the index on aggregatedindicatorvalue.
+     */
+    void dropIndex( boolean dataElement, boolean indicator );
+    
     // ----------------------------------------------------------------------
     // AggregatedDataMapValue
     // ----------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-01-19 11:57:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedDataValueStore.java	2011-01-21 11:06:16 +0000
@@ -110,6 +110,24 @@
      */
     public int countDataValuesAtLevel( OrganisationUnit orgunit, OrganisationUnitLevel level, Collection<Period> periods );
 
+    /**
+     * Creates indexes on the aggregateddatavalue and aggregatedindicatorvalue
+     * tables.
+     * 
+     * @param dataElement indicates whether to create an index on aggregateddatavalue.
+     * @param indicator indicates whether to create an index on aggregatedindicatorvalue.
+     */
+    void createIndex( boolean dataElement, boolean indicator );
+    
+    /**
+     * Drops the indexes on the aggregateddatavalue and aggregatedindicatorvalue
+     * tables.
+     * 
+     * @param dataElement indicates whether to drop the index on aggregateddatavalue.
+     * @param indicator indicates whether to drop the index on aggregatedindicatorvalue.
+     */
+    void dropIndex( boolean dataElement, boolean indicator );
+    
     // ----------------------------------------------------------------------
     // AggregatedDataMapValue
     // ----------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-01-21 10:40:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedDataValueService.java	2011-01-21 11:06:16 +0000
@@ -118,7 +118,17 @@
     {
         return aggregatedDataValueStore.countDataValuesAtLevel( orgunit, level, periods );
     }
+    
+    public void createIndex( boolean dataElement, boolean indicator )
+    {
+        aggregatedDataValueStore.createIndex( dataElement, indicator );
+    }
 
+    public void dropIndex( boolean dataElement, boolean indicator )
+    {
+        aggregatedDataValueStore.dropIndex( dataElement, indicator );
+    }
+    
     // -------------------------------------------------------------------------
     // AggregatedDataMapValue
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-01-21 10:40:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedDataValueStore.java	2011-01-21 11:06:16 +0000
@@ -217,12 +217,10 @@
         }
         finally
         {
-            // don't close holder or we lose resultset - iterator must close
-            // holder.close();
+            // Don't close holder or we lose resultset - iterator must close
         }
     }
 
-
     @Override
     public int countDataValuesAtLevel( OrganisationUnit rootOrgunit, OrganisationUnitLevel level, Collection<Period> periods )
     {
@@ -276,6 +274,36 @@
     {
         return statementManager.getHolder().executeUpdate( "DELETE FROM aggregateddatavalue" ); 
     }
+    
+    public void createIndex( boolean dataElement, boolean indicator )
+    {
+        if ( dataElement )
+        {
+            final String sql = "CREATE INDEX aggregateddatavalue_index ON aggregateddatavalue (dataelementid, categoryoptioncomboid, periodid, organisationunitid)";        
+            statementManager.getHolder().executeUpdate( sql );
+        }
+        
+        if ( indicator )
+        {
+            final String sql = "CREATE INDEX aggregatedindicatorvalue_index ON aggregatedindicatorvalue (indicatorid, periodid, organisationunitid)";        
+            statementManager.getHolder().executeUpdate( sql );
+        }
+    }
+    
+    public void dropIndex( boolean dataElement, boolean indicator )
+    {
+        if ( dataElement )
+        {
+            final String sql = "DROP INDEX aggregateddatavalue_index";
+            statementManager.getHolder().executeUpdate( sql );
+        }
+        
+        if ( indicator )
+        {
+            final String sql = "DROP INDEX aggregatedindicatorvalue_index";
+            statementManager.getHolder().executeUpdate( sql );
+        }
+    }
 
     // -------------------------------------------------------------------------
     // AggregatedDataMapValue

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-01-17 16:17:06 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-01-21 11:06:16 +0000
@@ -108,13 +108,13 @@
     {
         setWaitMessage( i18n_please_wait );
         
-        waitAndGetReportStatus( 1500 );
+        waitAndGetReportStatus( 1000 );
     }
     else
     {
         setWaitMessage( i18n_please_wait + " - " + statusMessage );
         
-        waitAndGetReportStatus( 1500 );
+        waitAndGetReportStatus( 1000 );
     }
 }