mirror of https://github.com/MISP/MISP
chg: FORCE index hint instead of USE see #8633
parent
e1f3d12d4e
commit
39f5a3b556
|
@ -1580,7 +1580,7 @@ class AttributesController extends AppController
|
|||
|
||||
// Force index for performance reasons see #3321
|
||||
if (isset($filters['value'])) {
|
||||
$this->paginate['useIndexHint'] = '(value1, value2)';
|
||||
$this->paginate['forceIndexHint'] = '(value1, value2)';
|
||||
}
|
||||
|
||||
$this->paginate['conditions'] = $params['conditions'];
|
||||
|
|
|
@ -49,7 +49,7 @@ class MysqlExtended extends Mysql
|
|||
'group' => $this->group($query['group'], $Model),
|
||||
'having' => $this->having($query['having'], true, $Model),
|
||||
'lock' => $this->getLockingHint($query['lock']),
|
||||
'indexHint' => $this->__buildIndexHint($query['useIndexHint'] ?? null),
|
||||
'indexHint' => $this->__buildIndexHint($query['forceIndexHint'] ?? null),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class MysqlExtended extends Mysql
|
|||
'group' => $queryData['group'],
|
||||
'having' => $queryData['having'],
|
||||
'lock' => $queryData['lock'],
|
||||
'useIndexHint' => $queryData['useIndexHint'] ?? null,
|
||||
'forceIndexHint' => $queryData['forceIndexHint'] ?? null,
|
||||
),
|
||||
$Model
|
||||
);
|
||||
|
@ -111,12 +111,12 @@ class MysqlExtended extends Mysql
|
|||
/**
|
||||
* Builds the index hint for the query
|
||||
*
|
||||
* @param string|null $useIndexHint USE INDEX hint
|
||||
* @param string|null $forceIndexHint FORCE INDEX hint
|
||||
* @return string
|
||||
*/
|
||||
private function __buildIndexHint($useIndexHint = null): ?string
|
||||
private function __buildIndexHint($forceIndexHint = null): ?string
|
||||
{
|
||||
return isset($useIndexHint) ? ('USE INDEX ' . $useIndexHint) : null;
|
||||
return isset($forceIndexHint) ? ('FORCE INDEX ' . $forceIndexHint) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue