perf(db): optimise indices of mail tables
Fix: #9162
Needs https://github.com/nextcloud/server/pull/43209 to also replace indices.
What should happen:
oc_mail_messages
- add index on
structure_analyzed->mail_messages_strucanalyz_idx - drop index
mail_messages_mailbox_idbecausemail_messages_mb_id_uidalready containsmailbox_idon first position - make
mail_messages_mb_id_uidunique ->mail_messages_mb_id_uid_uidx
oc_mail_classifiers
- add index on
created_at->mail_class_creat_idx
oc_mail_accounts
- add index on
provisioning_id->mail_acc_prov_idx
oc_mail_smime_certificates
- extend
mail_smime_certs_uid_idxto cover(user_id,email_address)->mail_smime_certs_uid_email_idx - drop
mail_smime_certs_id_uid_idx
oc_mail_tags
- drop
mail_msg_tags_usr_id_indexbecausemail_msg_tags_usr_lbl_idxalready containsuser_idon first position
oc_mail_aliases
- add index on
account_id->mail_alias_accid_idx
oc_mail_trusted_senders
- add index on
(user_id,email,type)and dropmail_trusted_senders_type->mail_trusted_senders_idx
oc_mail_coll_addresses
- add index on
(user_id, email, display_name)and dropmail_coll_addr_userid_indexandmail_coll_addr_email_index->mail_coll_idx
I commented out the index creation of the indices to drop.
It would be possible to also comment out the creation of the indices that are replaced and add the new ones in the migration, to have new instances up to date without "occ missingindices". The Migration will have a lot of checks in this case, which can be confusing. What do you think?
Hello there, Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6
Thank you for contributing to Nextcloud and we hope to hear from you soon!