From 488bddb02a4de686695f897738403d224d65e11c Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Tue, 7 Jul 2020 20:43:08 +0300 Subject: [PATCH] [NOTICE] Update index for verbs in ProfileNoticeStream After adding a verb condition there, MariaDB now prefers the ("created", "id", "is_local") and ("profile_id", "verb", "created", "id") indices for that query, even though they are slow for the job. So replace them with ("is_local", "created", "id") and ("profile_id", "verb", "created", "id") respectively. Also fix the naming of the ("profile_id", "created", "id") index. --- classes/Notice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index c2a4c63298..39fc3c0c12 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -105,14 +105,14 @@ class Notice extends Managed_DataObject 'notice_repeat_of_fkey' => array('notice', array('repeat_of' => 'id')), # @fixme: what about repeats of deleted notices? ), 'indexes' => array( - 'notice_created_id_is_local_idx' => array('created', 'id', 'is_local'), - 'notice_profile_id_idx' => array('profile_id', 'created', 'id'), + 'notice_is_local_created_id_idx' => array('is_local', 'created', 'id'), + 'notice_profile_id_created_id_idx' => array('profile_id', 'created', 'id'), + 'notice_profile_id_verb_scope_created_id_idx' => array('profile_id', 'verb', 'scope', 'created', 'id'), 'notice_is_local_created_profile_id_idx' => array('is_local', 'created', 'profile_id'), 'notice_repeat_of_created_id_idx' => array('repeat_of', 'created', 'id'), 'notice_conversation_created_id_idx' => array('conversation', 'created', 'id'), 'notice_object_type_idx' => array('object_type'), 'notice_verb_idx' => array('verb'), - 'notice_profile_id_verb_idx' => array('profile_id', 'verb'), 'notice_url_idx' => array('url'), // Qvitter wants this 'notice_replyto_idx' => array('reply_to') )