OCC commands in shared hosting! "occ db: add-missing-indices"
Steps to reproduce
Hi, I use nextcloud on a shared hosting and since I upgraded to version 14.0.1 the indexes are no longer updated in the database and to update them I should launch this command occ db: add-missing-indices, but I can not do it since I use a shared hosting! Could you work on this problem that affects a large slice of users? thank you so much
Server configuration
Operating system: CentOS
Web server: Hosting Linux Aruba
Database: MySql
PHP version: 7.2.8
Nextcloud version: 14.0.1
Can second that. Happened on all instances I have updated.
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/11167 (occ db:add-missing-indices - Exact steps to resolve?), https://github.com/nextcloud/server/issues/11463 (Missing-index), https://github.com/nextcloud/server/issues/10926 (Possible DB indexes), https://github.com/nextcloud/server/issues/10656 (Configuration check - Minor typo: occ db:add-missing-indices), and https://github.com/nextcloud/server/issues/866 (Calendar Share Functionality missing).
Hi, I use nextcloud on a shared hosting and since I upgraded to version 14.0.1 the indexes are no longer updated in the database and to update them I should launch this command occ db: add-missing-indices, but I can not do it since I use a shared hosting! Could you work on this problem that affects a large slice of users? thank you so much
There is a reason why this is a CLI command: it could take a bigger amount of time to complete and getting this command killed by the Webserver would result in a broken DB. Thus we added it to the CLI interface. Also if you run on a shared hosting instance there is not so much performance impact because usually those instances aren't that huge and only serve a handful of users. This optimization is basically for large instances that take advantage when sharing pages have hundreds of thousands of entries.
But we can check on showing the SQL statements that are needed to add those indexes then.
cc @nickvergessen @rullzer
Mine is not a large instance but still hosts 500 users and 200 GB of files. This operation could be completed without problems during web browsing, to avoid the timeout you could separate this operation from the web update and you could allow to run it optionally later "it could be a good solution"
PS: Would there be a way to directly perform this operation from phpMyAdmin?
to avoid the timeout you could separate this operation from the web update and you could allow to run it optionally later "it could be a good solution"
There is no way to separate this from web requests if there are only web requests possible. The CLI would be the timeout-free approach ;)
PS: Would there be a way to directly perform this operation from phpMyAdmin?
I will link some resources where SQL statements could be build from so the message can be improved.
Current queries to run are:
ALTER TABLE `oc_share` ADD KEY `share_with_index` (`share_with`) USING BTREE;
ALTER TABLE `oc_share` ADD KEY `parent_index` (`parent`) USING BTREE;
ALTER TABLE `oc_filecache` ADD KEY `fs_mtime` (`mtime`) USING BTREE;
Thanks a lot to everyone for the availability! You could provide more details on how to perform queries (for those who are not a web expert like me)
Well you better google that or ask for help in the forums. We can't really give you support on administration side of things in our bugtracker.
you're right, however it was simpler than I thought :)! PS: when I perform this operation, do I have to put the instance into maintenance? thank you
PS: when I perform this operation, do I have to put the instance into maintenance? thank you
Not needed. The DB handles this properly.
Let's close this ticket here for now as there are the SQL statements.
I launched the query on the database the result was the following:
ALTER TABLE oc_share ADD KEY share_with_index (share_with) USING BTREE; # MySQL returned an empty set (i.e. zero lines).
ALTER TABLE oc_share ADD KEY parent_index (parent) USING BTREE; # MySQL returned an empty set (i.e. zero lines).
ALTER TABLE oc_filecache ADD KEY fs_mtime (mtime) USING BTREE; # MySQL returned an empty set (i.e. zero lines).
Was this the result to be obtained?
Assuming there could be code that can estimate if the query could be successful given the maximum script execution time configuration. If that is within the estimated limit, the query could be executed in the browser. In several of the instances, I have updated it took between 2-10 seconds to complete.
Thank you have a nice day !
@ddi98, is the warning gone from Nextcloud after you ran the query? If not, are you running it against the Nextcloud database?
Assuming there could be code that can estimate if the query could be successful given the maximum script execution time configuration. If that is within the estimated limit, the query could be executed in the browser. In several of the instances, I have updated it took between 2-10 seconds to complete.
I'm not aware of any estimations like this. :/
the warning was returned by phpmyadmin, so the operation was not successful?
Was this the result to be obtained?
Looks good, because adding an index does not return anything.
@MorrisJobke, assuming the amount of time required for a query of that type to complete is based on the number of records in the given table. Thinking about it, that doesn't say much about the speed of database procedures (disk IOPS, ram, available CPU time, etc)...
In any case, the request turns out to be much more powerful! It would be nice to add these queries in the official documentation