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
path: root/core
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-12-05 15:12:57 +0300
committermattab <matthieu.aubry@gmail.com>2014-12-05 15:12:57 +0300
commit269ffeb4b71926fa4973aa0075943dcc2426bd08 (patch)
tree86329f4c10dba1e300cc4f0b672647e838b26a50 /core
parent9610d1b785cb05e06b94eb2c749e7a7f80dcc90b (diff)
ORDER BY the inner query so the order is deterministic + It uses the INDEX
Diffstat (limited to 'core')
-rw-r--r--core/DataAccess/LogQueryBuilder.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/DataAccess/LogQueryBuilder.php b/core/DataAccess/LogQueryBuilder.php
index 132480514b..b062b91b3f 100644
--- a/core/DataAccess/LogQueryBuilder.php
+++ b/core/DataAccess/LogQueryBuilder.php
@@ -185,9 +185,14 @@ class LogQueryBuilder
$innerFrom = $from;
$innerWhere = $where;
$innerGroupBy = "log_visit.idvisit";
- $innerOrderBy = "NULL";
$innerLimit = $limit;
+ $innerOrderBy = "NULL";
+ // Only when there is a LIMIT then we can apply to the inner query the same ORDER BY as the parent query
+ if($innerLimit) {
+ $innerOrderBy = $orderBy;
+ }
+
$innerQuery = $this->buildSelectQuery($innerSelect, $innerFrom, $innerWhere, $innerGroupBy, $innerOrderBy, $innerLimit);
$select = preg_replace('/'.$matchTables.'\./', 'log_inner.', $select);