Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(SetupChecks): Refactor DatabaseHasMissingIndices #45272

Merged
merged 1 commit into from May 13, 2024

Conversation

joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented May 11, 2024

Summary

  • Eliminate the redundant Missing optional index [...] in front of every listed missing index
  • Add docs link
  • Use "indices" consistently over "indexes" since we're using that for the relevant occ command
  • Re-order and reword the explanation and instructions

Before

The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running "occ db:add-missing-indices" those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster. Missing optional index "mail_messages_strucanalyz_idx" in table "mail_messages". Missing optional index "mail_class_creat_idx" in table "mail_classifiers". Missing optional index "mail_acc_prov_idx" in table "mail_accounts". Missing optional index "mail_alias_accid_idx" in table "mail_aliases".

After

Detected some missing optional indices. Occasionally new indices are added (by Nextcloud or installed applications) to improve database performance. Adding indices can sometimes take awhile and temporarily hurt performance so this is not done automatically during upgrades. Once the indices are added, queries to those tables should be faster. Use the command occ db:add-missing-indices to add them. Missing indices: "mail_messages_strucanalyz_idx" in table "mail_messages", "mail_class_creat_idx" in table "mail_classifiers", "mail_acc_prov_idx" in table "mail_accounts", "mail_alias_accid_idx" in table "mail_aliases". For more details see the documentation ↗.

TODO

Checklist

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 30 milestone May 11, 2024
@joshtrichards joshtrichards added the 3. to review Waiting for reviews label May 11, 2024
@juliushaertl juliushaertl merged commit a5fc9b1 into master May 13, 2024
156 checks passed
@juliushaertl juliushaertl deleted the check-db-missing-indices branch May 13, 2024 05:55
Comment on lines +98 to +102
$processed++;
$list .= "\n " . $this->l10n->t('"%s" in table "%s"', [$missingIndex['indexName'], $missingIndex['tableName']]);
if (count($missingIndices) > $processed) {
$list .= ", ";
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally list should be formatted in markdown for security_guard.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can stick a - in front of each item in a follow-up, but it'll look funny in the current Overview since they will get displayed literally. Is there a more correct approach?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a more correct approach?

I don’t think so. We were pondering cutting after a double line break on core UI to be able to have more info only appearing in cli&security_guard but did not went forward with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants