mirror of https://github.com/MISP/MISP
fix: [performance] Potential performance fix for older MySQL versions using the wrong index as key during fetchAttributes()
- observer a server prioritising the deleted flag index when filtering attributes, leading to a massive performance loss - hacky solution to make deleted and object_id (during flattening) indeces unusablepull/4048/head
parent
17943e2533
commit
27d048db0c
|
@ -3608,7 +3608,8 @@ class EventsController extends AppController
|
|||
$options = array(
|
||||
'conditions' => array('OR' => array('Attribute.value1' => $result['value'], 'Attribute.value2' => $result['value'])),
|
||||
'fields' => array('Attribute.type', 'Attribute.category', 'Attribute.value', 'Attribute.comment'),
|
||||
'order' => false
|
||||
'order' => false,
|
||||
'flatten' => 1
|
||||
);
|
||||
$resultArray[$key]['related'] = $this->Event->Attribute->fetchAttributes($this->Auth->user(), $options);
|
||||
}
|
||||
|
|
|
@ -2890,7 +2890,7 @@ class Attribute extends AppModel
|
|||
$params['conditions']['AND'][] = $options['conditions'];
|
||||
}
|
||||
if (empty($options['flatten'])) {
|
||||
$params['conditions']['AND'][] = array('Attribute.object_id' => 0);
|
||||
$params['conditions']['AND'][] = array('(Attribute.object_id + 0)' => 0);
|
||||
}
|
||||
if (isset($options['order'])) {
|
||||
$params['order'] = $options['order'];
|
||||
|
@ -2902,7 +2902,7 @@ class Attribute extends AppModel
|
|||
$options['enforceWarninglist'] = false;
|
||||
}
|
||||
if (!$user['Role']['perm_sync'] || !isset($options['deleted']) || !$options['deleted']) {
|
||||
$params['conditions']['AND']['Attribute.deleted'] = 0;
|
||||
$params['conditions']['AND']['(Attribute.deleted + 0)'] = 0;
|
||||
}
|
||||
if (isset($options['group'])) {
|
||||
$params['group'] = empty($options['group']) ? $options['group'] : false;
|
||||
|
|
Loading…
Reference in New Issue