Nextcloud version (eg, 20.0.5): 24.0.0
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.4): 8.0.17
We have a nextcloud instance with ~70K files, we use comments to add metadatas to the files in order to perform search quickly on them. oc_comments table has now ~150K lines.
Everytime a user open a Nextcloud session, it seems that an indexation of the oc_comments table is launched, causing de mariadb server to crash running out of memory :
MariaDB [nextcloud]> show full processlist;
| 113 | nextcloud_db_user | next.dummy.fr:55116 | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments
WHERE object_type
= ‘files’ ORDER BY creation_timestamp
DESC, id
DESC LIMIT 100 OFFSET 76500 | 0.000 |
| 166 | nextcloud_db_user | next.dummy.fr:55268 | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments
WHERE object_type
= ‘files’ ORDER BY creation_timestamp
DESC, id
DESC LIMIT 100 OFFSET 76400 | 0.000 |
| 198 | nextcloud_db_user | next.dummy.fr:55340 | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments
WHERE object_type
= ‘files’ ORDER BY creation_timestamp
DESC, id
DESC LIMIT 100 OFFSET 76500 | 0.000 |
The forced reindexation of this table is not very scalable. Why Nextcloud want to recreate sort index at each opening session, even if no new files were added ?
Is this the first time you’ve seen this error? (Y/N): Error appears when we populate the table oc_comments. If we delete our “metadata comments”, it’s ok.
Steps to replicate it:
- Add thousand of comments into the oc_comments table
- Open a nextcloud session and browse files
- See the mysql/mariadb processes
no relevant errors in logs.