mail icon indicating copy to clipboard operation
mail copied to clipboard

perf(db): optimise indices of mail tables

Open JohannesGGE opened this issue 1 year ago • 1 comments

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_id because mail_messages_mb_id_uid already contains mailbox_id on first position
  • make mail_messages_mb_id_uid unique -> 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_idx to 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_index because mail_msg_tags_usr_lbl_idx already contains user_id on 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 drop mail_trusted_senders_type -> mail_trusted_senders_idx

oc_mail_coll_addresses

  • add index on (user_id, email, display_name) and drop mail_coll_addr_userid_index and mail_coll_addr_email_index -> mail_coll_idx

JohannesGGE avatar Feb 05 '24 19:02 JohannesGGE

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?

JohannesGGE avatar Feb 18 '24 21:02 JohannesGGE

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!

github-actions[bot] avatar Apr 03 '24 02:04 github-actions[bot]