You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2009/08/26 02:41:58 UTC

svn commit: r807859 - /ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Author: lektran
Date: Wed Aug 26 00:41:57 2009
New Revision: 807859

URL: http://svn.apache.org/viewvc?rev=807859&view=rev
Log:
Switched FindGeneric.groovy back to using findCountByCondition rather than eli.getResultSizeAfterPartialList()

I found on my local machine that for every 100,000 rows in the result set getResultSizeAfterPartialList would take an additional 5-7 seconds to execute.
findCountByCondition was taking roughly 2 seconds at most to count 700,000 records

Modified:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy?rev=807859&r1=807858&r2=807859&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy Wed Aug 26 00:41:57 2009
@@ -150,8 +150,6 @@
     }
     condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
 
-    // DEJ 20080701 avoid using redundant query, will use eli.getResultsSizeAfterPartialList() below instead: arraySize = (int) delegator.findCountByCondition(entityName, condition, null, null);
-
     if ((highIndex - lowIndex + 1) > 0) {
         boolean beganTransaction = false;
         try {
@@ -177,7 +175,10 @@
             resultEli = delegator.find(entityName, condition, null, fieldsToSelect, null, efo);
             resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1);
 
-            arraySize = resultEli.getResultsSizeAfterPartialList();
+            // DEJ 20080701 avoid using redundant query, will use eli.getResultsSizeAfterPartialList() below instead: arraySize = (int) delegator.findCountByCondition(entityName, condition, null, null);
+            // SG 20090826 switched back to findCountByCondition, resultSet.last() appears to take O(n) time whereas findCountByCondition is almost constant regardless of the result size
+            //arraySize = resultEli.getResultsSizeAfterPartialList();
+            arraySize = delegator.findCountByCondition(entityName, condition, null);
             if (arraySize < highIndex) {
                 highIndex = arraySize;
             }