-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
OCC commands in shared hosting! "occ db: add-missing-indices" #11491
Comments
Can second that. Happened on all instances I have updated. |
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. |
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? |
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 ;)
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! |
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 :)! |
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 ALTER TABLE ALTER TABLE 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? |
I'm not aware of any estimations like this. :/ |
the warning was returned by phpmyadmin, so the operation was not successful? |
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! |
The queries are working as expected, adding the indexes and the warning is gone after execution. (14.0.1) |
The three queries mentioned above solved three issue. The following remain:
|
Hello, I reopened the discussion to which you gave me solution some time ago :), after updating to nextcloud 15.0.2 a similar problem has resurfaced, would you be so kind to help me? :) these are the errors: 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. Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running 'occ db:convert-filecache-bigint' those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read the documentation page about this. |
Please check here: |
@MorrisJobke Is there any open issue which tracks your idea? Because i - and many others, which are unable to use the occ component, would really appreciate if you would provide the required SQL commands right with the error inside the settings page of nextcloud (or at least a link). |
Not really - let's reopen this for now. |
It's really frustrating to google for the queries after each update. Is there any document available which is always up-to date and lists the queries which must be executed after each update?
-- MySQL
ALTER TABLE `oc_whats_new` ADD KEY `version` (`version`) USING BTREE;
ALTER TABLE `oc_twofactor_providers` ADD KEY `twofactor_providers_uid` (`uid`) USING BTREE;
ALTER TABLE `oc_cards` ADD KEY `cards_abid` (`addressbookid`) USING BTREE;
ALTER TABLE `oc_cards_properties` ADD KEY `cards_prop_abid` (`addressbookid`) USING BTREE; ref https://help.nextcloud.com/t/missing-indices-on-nc16/52284 15.0.7 > 16.0.1. As it seems that this is not going to be implemented in the near feature, isn't it? The OCC Web app (https://apps.nextcloud.com/apps/occweb) is a good approach, but unfortunately it seems like it isn't really well maintained as there's no official version for Nextcloud 16 available. |
ich habe folgende Fehlermeldung (leider keine Lösung ergoogled) wenn ich in meinem phpmyadmin dies hier eingebe:
Fehler ALTER TABLE #1061 - Doppelter Name für Schlüssel vorhanden: 'share_with_index' Was kann ich noch machen um mein Problem zu lösen? english: I have the following error message (unfortunately no solution ergoogled) if I enter this in my phpmyadmin this:
error ALTER TABLE # 1061 - Duplicate key name exists: 'share_with_index' What else can I do to solve my problem? |
The index with the name |
thanxs for tis fast support.
How i solve this? |
What about the occ shell app for shared environment? |
occ shell does work on our Strato hosted website. NC 16.0.1 |
I see
Also, I have to second @FireEmerald 's frustration. |
In your shell run:
if that works, try the following in your nextcloud directory:
|
FYI: If using Plesk the scheduled task feature can be used to run occ commands:
https://help.nextcloud.com/t/how-to-execute-an-occ-command-using-scheduled-tasks-on-plesk/134098/2 |
You can use FTP access to add your own php file that executes custom
This creates the file Is there any reason why such a file shouldn't be part of nextcloud server, to support users that want to fix problems after upgrading, but cannot run |
It may be worth converting some of these entries to a wiki entry or documentation file, as most existing documentation points to the In a shared-hosting situation, where only the phpMyAdmin access is viable, these queries would be useful. For the 26.0.X -> 27.0.0 upgrade, I am encountering this issue now:
And digging into the script for occ db:addissing-indices, the new step for this adds index
however attempting define these runs into a length issue I see that the php file seems to define lengths of
Gives the error:
Since this is a syntax error, Is there a different way should be applied? Based on my reading, it seems like the appropriate method would have either been to use parenthetical value of length ( |
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
The text was updated successfully, but these errors were encountered: