server icon indicating copy to clipboard operation
server copied to clipboard

Possible DB indexes

Open rullzer opened this issue 7 years ago • 3 comments

  • [ ] 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;

rullzer avatar Aug 29 '18 15:08 rullzer

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).

nextcloud-bot avatar Aug 29 '18 16:08 nextcloud-bot

See also #8937

J0WI avatar Aug 07 '21 20:08 J0WI

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.

etam avatar Mar 09 '22 20:03 etam

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

ChristophWurst avatar Mar 12 '25 10:03 ChristophWurst