Skip to content

Conversation

@icewind1991
Copy link
Member

for the following query SELECT "path" FROM "oc_filecache" WHERE ("storage" = $storage) AND ("size" < 0) ORDER BY "fileid" DESC LIMIT 1; which is used by the background scanner.

currently the database will in some cases decide to prioritize the sort by fileid over the filter when picking what index to use, resulting in a much slower query.

by creating an index that allows first sorting by fileid and also filter by storage and size this case will be greatly sped up

Signed-off-by: Robin Appelman [email protected]

for the following query 'SELECT "path" FROM "oc_filecache" WHERE ("storage" = $storage) AND ("size" < 0) ORDER BY "fileid" DESC LIMIT 1;'

currently the database will in some cases decide to priorize the sort by fileid over the filter when picking what index to use, resulting in a much slower query.

by creating an index that allows first sorting by fileid and also filter by storage and size this case will be greatly sped up

Signed-off-by: Robin Appelman <[email protected]>
@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Oct 7, 2021
@icewind1991 icewind1991 added this to the Nextcloud 23 milestone Oct 7, 2021
@icewind1991 icewind1991 requested a review from PVince81 October 7, 2021 14:18
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense

so this is for the BackgroundScanner

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 8, 2021
@PVince81 PVince81 merged commit 1ea5983 into master Oct 8, 2021
@PVince81 PVince81 deleted the incomplete-index branch October 8, 2021 10:07
@PVince81
Copy link
Member

PVince81 commented Oct 8, 2021

@icewind1991 backports? wouldn't be too good for patch releases if we don't want DB updates

@PVince81
Copy link
Member

/backport to stable22

@PVince81
Copy link
Member

/backport to stable21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish performance 🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants