mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Add force index in report mysql request to avoid full scan table
This commit is contained in:
@@ -61,8 +61,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
|
||||
$this->sql = "
|
||||
SELECT TRIM(" . $this->getTransQuery($this->groupby) . ")
|
||||
as " . $this->groupby . ", SUM(1) as nb
|
||||
FROM (log)
|
||||
INNER JOIN log_colls ON (log.id = log_colls.log_id)";
|
||||
FROM log FORCE INDEX (date_site)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)";
|
||||
|
||||
if ($report_filter['sql'])
|
||||
$this->sql .= " WHERE " . $report_filter['sql'];
|
||||
@@ -86,8 +86,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
|
||||
|
||||
$sql = '
|
||||
SELECT DISTINCT(' . $this->getTransQuery($field) . ') as val
|
||||
FROM (log)
|
||||
INNER JOIN log_colls ON (log.id = log_colls.log_id)';
|
||||
FROM log FORCE INDEX (date_site)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)';
|
||||
|
||||
if ($report_filter['sql'])
|
||||
$sql .= ' WHERE ' . $report_filter['sql'];
|
||||
|
Reference in New Issue
Block a user