From 6e8ec4575c1b19af63fe4910dd0dd7c5dc8a6003 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Wed, 18 Mar 2015 03:40:20 +0000 Subject: faster archive by calculating the recursive count only if needed --- core/ArchiveProcessor.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/ArchiveProcessor.php') diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index 81ac213344..8f7b979915 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -187,6 +187,8 @@ class ArchiveProcessor * @param array $columnsToRenameAfterAggregation Columns mapped to new names for columns that must change names * when summed because they cannot be summed, eg, * `array('nb_uniq_visitors' => 'sum_daily_nb_uniq_visitors')`. + * @param bool $countRowsRecursive if set to false, will not calculate the recursive rows count which results in + * faster aggregation * @return array Returns the row counts of each aggregated report before truncation, eg, * * array( @@ -203,7 +205,8 @@ class ArchiveProcessor $maximumRowsInSubDataTable = null, $columnToSortByBeforeTruncation = null, &$columnsAggregationOperation = null, - $columnsToRenameAfterAggregation = null) + $columnsToRenameAfterAggregation = null, + $countRowsRecursive = true) { if (!is_array($recordNames)) { $recordNames = array($recordNames); @@ -216,8 +219,9 @@ class ArchiveProcessor $table = $this->aggregateDataTableRecord($recordName, $columnsAggregationOperation, $columnsToRenameAfterAggregation); $nameToCount[$recordName]['level0'] = $table->getRowsCount(); - - $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive(); + if ($countRowsRecursive) { + $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive(); + } $blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation); Common::destroy($table); -- cgit v1.2.3