[NodeInfo][DATABASE] Adjust indices of the "notice" and "user" tables

On big databases these queries from the Nodeinfo plugin choked up:

SELECT profile_id FROM notice
  WHERE notice.created >= (CURRENT_DATE - INTERVAL '180' DAY)
  AND notice.is_local = 1;
SELECT id FROM "user"
  WHERE "user".created >= (CURRENT_DATE - INTERVAL '180' DAY);
This commit is contained in:
Alexei Sorokin 2019-11-03 18:57:03 +03:00 committed by Diogo Peralta Cordeiro
parent fbc6fe0818
commit 53af27a303
2 changed files with 2 additions and 0 deletions

View File

@ -107,6 +107,7 @@ class Notice extends Managed_DataObject
'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_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'),

View File

@ -102,6 +102,7 @@ class User extends Managed_DataObject
'user_carrier_fkey' => array('sms_carrier', array('carrier' => 'id')),
),
'indexes' => array(
'user_created_idx' => array('created'),
'user_smsemail_idx' => array('smsemail'),
),
);