chg: FORCE index hint instead of USE see #8633

pull/8637/head
Luciano Righetti 2022-10-04 16:22:34 +02:00
parent e1f3d12d4e
commit 39f5a3b556
No known key found for this signature in database
GPG Key ID: CB91F2A37C557248
2 changed files with 6 additions and 6 deletions

View File

@ -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'];

View File

@ -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;
}
/**