← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10409: Analytics, minor performance improvement on table generation

 

------------------------------------------------------------
revno: 10409
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-03-24 19:40:42 +0100
message:
  Analytics, minor performance improvement on table generation
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java


--
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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2013-02-19 11:54:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractJdbcTableManager.java	2013-03-24 18:40:42 +0000
@@ -134,13 +134,11 @@
 
     public boolean pruneTable( String tableName )
     {
-        final String sqlCount = "select count(*) from " + tableName;
-        
-        log.info( "Count SQL: " + sqlCount );
-        
-        final boolean empty = jdbcTemplate.queryForInt( sqlCount ) == 0;
-        
-        if ( empty )
+        final String sql = "select * from " + tableName + " limit 1";
+        
+        final boolean hasRows = jdbcTemplate.queryForRowSet( sql ).next();
+        
+        if ( !hasRows )
         {
             final String sqlDrop = "drop table " + tableName;