Project

General

Profile

Actions

"Missing indexes in Nextcloud database"

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 index "mounts_class_index" in table "oc_mounts".

Nextcloud is informing you that some indexes are missing in the database. Adding indexes can significantly improve the performance of database queries. However, adding indexes to large tables can take a long time, which is why the indexes were not added automatically. Nextcloud recommends running the "occ db:add-missing-indices" command to add the missing indexes manually while the instance is running. The message may also provide the name of the missing index and the name of the table it belongs to, such as the "mounts_class_index" index in the "oc_mounts" table.

To add the missing indexes in Nextcloud, you can run the following command in your terminal or command prompt:

You can run the script in the command line, so make sure you are logged in to the server where Nextcloud is installed and navigate to the Nextcloud directory. Once you are in the top-level directory of your Nextcloud installation, you can run the script.

This command will add any missing indexes to the Nextcloud database. However, keep in mind that adding indexes to large tables can take some time, so the process may take a while to complete.

sudo -u www-data php occ db:add-missing-indices

You can also add the --no-interaction flag at the end of the command to avoid having to confirm each index addition manually:

sudo -u www-data php occ db:add-missing-indices --no-interaction

After the command has finished, your Nextcloud instance should be optimized and queries to the relevant tables should be faster.

Updated by Gareth Eaton about 1 year ago · 1 revisions