Skip to content
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

Missed sql index #4625

Closed
Temtaime opened this issue May 1, 2017 · 5 comments
Closed

Missed sql index #4625

Temtaime opened this issue May 1, 2017 · 5 comments
Assignees
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: filesystem

Comments

@Temtaime
Copy link
Contributor

Temtaime commented May 1, 2017

Table filecache has no index on the path column.
Slow query log sometimes shows that queries like

SELECT path, fileid FROM oc_filecache WHERE storage = '1' AND path LIKE 'files/projects%'

Take > 10 secs.
Adding an index on the 'path' column seems to help.

@LukasReschke
Copy link
Member

@LukasReschke LukasReschke added 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: filesystem labels May 1, 2017
@dirkpape
Copy link

dirkpape commented May 7, 2017

I had the same problem. In mysql-slow.log I saw queries like this lasting more than 40s when renaming a folder or sharing a folder when encryption was enabled.

# Query_time: 44.722292  Lock_time: 0.000035 Rows_sent: 13  Rows_examined: 648331
SET timestamp=1494139934;
SELECT `path`, `fileid` FROM `oc_filecache` WHERE `storage` = '4' AND `path` LIKE 'files\\_encryption/keys/files/<..path..cut>/%';

I created the index on the path column for oc_filecache and the problem was gone.
Thanks,
Dirk

@nickvergessen
Copy link
Member

Well makes sense, the main problem is that adding it to huge instances will take like forever.

@icewind1991
Copy link
Member

The problem is that not all mysql configurations allow creating index on long string columns meaning that we can't rely on indexes on this column.

Ongoing work is being done to reduce the number of queries that run into this problem

@MorrisJobke
Copy link
Member

We improved in this regard hugely. Please check out the latest version and check the admin page if there are pending indexes (it will show it to you and also list a command on how to add it).

Beside that we should focus on #10926

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: filesystem
Projects
None yet
Development

No branches or pull requests

7 participants