Possible DB indexes
- [ ] ALTER TABLE oc_cards ADD INDEX z_oc_cards (uri), ALGORITHM=INPLACE, LOCK=NONE;
- [x] ALTER TABLE oc_cards ADD INDEX z_oc_cards_add_uri (addressbookid,uri), ALGORITHM=INPLACE, LOCK=NONE;
- [x] ALTER TABLE oc_cards_properties ADD INDEX z_oc_cards_properties_add (addressbookid), ALGORITHM=INPLACE, LOCK=NONE;
- [ ] ALTER TABLE oc_filecache ADD INDEX z_oc_filecache_par_stor (parent,storage), ALGORITHM=INPLACE, LOCK=NONE;
- [ ] ALTER TABLE oc_filecache ADD INDEX z_oc_filecache_parent (parent), ALGORITHM=INPLACE, LOCK=NONE;
- [ ] ALTER TABLE oc_filecache ADD INDEX z_oc_filecache_par_st_sz (parent,storage,size), ALGORITHM=INPLACE, LOCK=NONE;
- [ ] ALTER TABLE oc_jobs ADD INDEX z_oc_jobs_reserved_at (reserved_at), ALGORITHM=INPLACE, LOCK=NONE;
- [x] ALTER TABLE oc_share ADD INDEX z_oc_share_uid_ini (uid_initiator ), ALGORITHM=INPLACE, LOCK=NONE;
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/8245 (Nextcloud DB Replication...), https://github.com/nextcloud/server/issues/1889 (Use callForSeenUsers where possible), https://github.com/nextcloud/server/issues/10602 (InvalidArgumentException: Index name), https://github.com/nextcloud/server/issues/1431 (Fulltext Search and indexing), and https://github.com/nextcloud/server/issues/4625 (Missed sql index).
See also #8937
I have a server with around 800'000 records in oc_filecache. Uploading lots of small files was causing huge load on server cpu. Adding an index on oc_filecache(parent) greatly reduced load and improved performance.
Thanks for the tip!
Adding an index on
oc_filecache(parent)greatly reduced load and improved performance.
That index should now exist thanks to https://github.com/nextcloud/server/blob/460765dd5b9cbdd173affe75ae3e2f6d4a704ce0/core/Application.php#L95-L99