Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-03-12 12:24:24 +0400
committermattab <matthieu.aubry@gmail.com>2014-03-12 12:24:24 +0400
commit3d3f3c0d9c79f75e05f7683197e53ac01064e3c6 (patch)
treec7f8e0202636ea920b42de2f4623999c6a394320 /core/ArchiveProcessor.php
parentdd9ec8712f10024cd4536ec9f15f98002980ea8d (diff)
Fixes #4768 Implement performance improvement for period=range: do not archive sub-tables (only the parent table).
The sub-tables will be archived only when idSubtable is found, or flat=1, or expanded=1
Diffstat (limited to 'core/ArchiveProcessor.php')
-rw-r--r--core/ArchiveProcessor.php34
1 files changed, 28 insertions, 6 deletions
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index f578673d01..20c4c2df80 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -199,8 +199,14 @@ class ArchiveProcessor
$table = $this->aggregateDataTableRecord($recordName, $columnsAggregationOperation, $columnsToRenameAfterAggregation);
- $nameToCount[$recordName]['level0'] = $table->getRowsCount();
- $nameToCount[$recordName]['recursive'] = $table->getRowsCountRecursive();
+ $rowsCount = $table->getRowsCount();
+ $nameToCount[$recordName]['level0'] = $rowsCount;
+
+ $rowsCountRecursive = $rowsCount;
+ if($this->isAggregateSubTables()) {
+ $rowsCountRecursive = $table->getRowsCountRecursive();
+ }
+ $nameToCount[$recordName]['recursive'] = $rowsCountRecursive;
$blob = $table->getSerialized($maximumRowsInDataTableLevelZero, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation);
Common::destroy($table);
@@ -322,7 +328,15 @@ class ArchiveProcessor
*/
protected function aggregateDataTableRecord($name, $columnsAggregationOperation = null, $columnsToRenameAfterAggregation = null)
{
- $dataTable = $this->getArchive()->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
+ if($this->isAggregateSubTables()) {
+ // By default we shall aggregate all sub-tables.
+ $dataTable = $this->getArchive()->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
+ } else {
+ // In some cases (eg. Actions plugin when period=range),
+ // for better performance we will only aggregate the parent table
+ $dataTable = $this->getArchive()->getDataTable($name, $idSubTable = null);
+ }
+
$dataTable = $this->getAggregatedDataTableMap($dataTable, $columnsAggregationOperation);
$this->renameColumnsAfterAggregation($dataTable, $columnsToRenameAfterAggregation);
return $dataTable;
@@ -402,7 +416,7 @@ class ArchiveProcessor
// as $date => $tableToSum
$this->aggregatedDataTableMapsAsOne($data, $table);
} else {
- $table->addDataTable($data);
+ $table->addDataTable($data, $this->isAggregateSubTables());
}
return $table;
}
@@ -418,7 +432,7 @@ class ArchiveProcessor
if($tableToAggregate instanceof Map) {
$this->aggregatedDataTableMapsAsOne($tableToAggregate, $aggregated);
} else {
- $aggregated->addDataTable($tableToAggregate);
+ $aggregated->addDataTable($tableToAggregate, $this->isAggregateSubTables());
}
}
}
@@ -430,7 +444,7 @@ class ArchiveProcessor
$columnsToRenameAfterAggregation = self::$columnsToRenameAfterAggregation;
}
foreach ($columnsToRenameAfterAggregation as $oldName => $newName) {
- $table->renameColumn($oldName, $newName);
+ $table->renameColumn($oldName, $newName, $this->isAggregateSubTables());
}
}
@@ -464,4 +478,12 @@ class ArchiveProcessor
}
return $metrics;
}
+
+ /**
+ * @return bool
+ */
+ protected function isAggregateSubTables()
+ {
+ return !$this->getParams()->isSkipAggregationOfSubTables();
+ }
}