feat(db): add occ db:info, db:size, db:index-usage and db:locks#60840
Merged
artonge merged 3 commits intoJun 11, 2026
Conversation
Implements RFC nextcloud#59422. Adds four read-only diagnostic commands to the occ CLI for administrators to inspect database health without needing external tools: - db:info: shows engine version and key config variables with health check against recommended values - db:size: lists all tables ordered by total disk usage - db:index-usage: reports unused indexes via performance_schema (MySQL) or pg_stat_user_indexes (PostgreSQL) - db:locks: detects active blocking transactions and deadlocks All commands support MySQL/MariaDB and PostgreSQL. A --json flag is available for automated parsing. Includes 31 unit tests. Closes nextcloud#59422 Signed-off-by: Rodrigo Correia <rodrigo.mendes.correia@tecnico.ulisboa.pt> Signed-off-by: Carolina Quinteiro <carolinafquinteiro@tecnico.ulisboa.pt> Co-authored-by: Carolina Quinteiro <carolinafquinteiro@tecnico.ulisboa.pt>
artonge
approved these changes
Jun 11, 2026
|
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
artonge
added a commit
that referenced
this pull request
Jun 11, 2026
Signed-off-by: Louis Chmn <louis@chmn.me>
artonge
added a commit
that referenced
this pull request
Jun 11, 2026
chore: Fix reuse licence after #60840
Contributor
|
@artonge @CarlSchwan Linter and Psalm failures are related. |
kesselb
reviewed
Jun 11, 2026
|
|
||
| if (!$showAll) { | ||
| $output->writeln(sprintf( | ||
| '<comment>Found %d unused index(es). Consider removing them to improve write performance.</comment>', |
Contributor
There was a problem hiding this comment.
I think we should reword that ;)
Collaborator
There was a problem hiding this comment.
What would you put instead? It sounds clear to me, but maybe the meaning needs to be changed 😅
Contributor
There was a problem hiding this comment.
I'm unsure about suggestiong to remove an index. We don't want user's messing around with the db schema?
Collaborator
There was a problem hiding this comment.
Changed in the follow-up PR
Suggested change
| '<comment>Found %d unused index(es). Consider removing them to improve write performance.</comment>', | |
| '<comment>Found %d unused index(es). If those were not created by Nextcloud, consider removing them to improve write performance.</comment>', |
kesselb
reviewed
Jun 11, 2026
kesselb
reviewed
Jun 11, 2026
kesselb
reviewed
Jun 11, 2026
pull Bot
pushed a commit
to Klomgor/server
that referenced
this pull request
Jun 11, 2026
Signed-off-by: Louis Chmn <louis@chmn.me>
giacomoarru
pushed a commit
to giacomoarru/server
that referenced
this pull request
Jun 11, 2026
Signed-off-by: Louis Chmn <louis@chmn.me> Signed-off-by: Jack Arru <jack@x2x.cloud>
giacomoarru
pushed a commit
to giacomoarru/server
that referenced
this pull request
Jun 11, 2026
Signed-off-by: Louis Chmn <louis@chmn.me> Signed-off-by: Jack Arru <jack@x2x.cloud>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(occ): add db:info, db:size, db:index-usage, db:locks diagnostic commands
Body:
Implements RFC #59422. Adds four read-only diagnostic commands to the occ CLI:
db:info— engine version and key config variables with health checksdb:size— tables ordered by total disk usagedb:index-usage— unused indexes (MySQL via performance_schema, PostgreSQL via pg_stat_user_indexes)db:locks— active blocking transactions and deadlocksSupports MySQL/MariaDB and PostgreSQL.
--jsonflag available for automated parsing.Includes 31 unit tests.
Closes #59422