From 9a5393847390235ea5ce0e18332263b328058686 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 24 Oct 2012 13:09:24 +0000 Subject: [PATCH] Optimization to speed-up the "group-by" tables. (The complete solution is implemented in 2.0) SVN:1.2.1[2337] --- application/displayblock.class.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 7817f49bdd..548043d0ec 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -348,7 +348,11 @@ class DisplayBlock $aGroupBy = array(); $sLabels = array(); $iTotalCount = $this->m_oSet->Count(); - while($oObj = $this->m_oSet->Fetch()) + $oTmpSet = clone $this->m_oSet; + // Speed up the load, load only the needed field to group on + $sAlias = $oTmpSet->GetFilter()->GetClassAlias(); + $oTmpSet->OptimizeColumnLoad(array($sAlias => array($sGroupByField))); + while($oObj = $oTmpSet->Fetch()) { if (isset($aExtraParams['group_by_expr'])) {