Skip to content

perf(sharing): Use oc_share.item_type IN instead of OR equals - #51669

Merged
provokateurin merged 1 commit into
masterfrom
refactor/use-in-instead-of-or
Mar 25, 2025
Merged

perf(sharing): Use oc_share.item_type IN instead of OR equals#51669
provokateurin merged 1 commit into
masterfrom
refactor/use-in-instead-of-or

Conversation

@marcelklehr

@marcelklehrmarcelklehr commented Mar 24, 2025

Copy link
Copy Markdown
Member

to improve performance by using the db index

Summary

We found a query like this that doesn't use the available index and seems to cause a table scan, which seems to be due to the use of OR instead of IN.

Thanks to @Altahrim for figuring this out.

Checklist

@marcelklehr
marcelklehr requested a review from a team as a code ownerMarch 24, 2025 14:42
@marcelklehr
marcelklehr requested review from come-nc, nfebe and provokateurin and removed request for a teamMarch 24, 2025 14:42

@provokateurinprovokateurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

perf would be the right conventional commit type ;)

…equals
to improve performance by using the db index
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehrforce-pushed the refactor/use-in-instead-of-or branch from eb72f1d to b464469CompareMarch 25, 2025 08:42
@marcelklehrmarcelklehr changed the title refactor(sharing): Use oc_share.item_type IN instead of OR equalsperf(sharing): Use oc_share.item_type IN instead of OR equalsMar 25, 2025
@provokateurinprovokateurin added 3. to review Waiting for reviews performance 🚀 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Mar 25, 2025
@provokateurinprovokateurin added this to the Nextcloud 32 milestone Mar 25, 2025
@provokateurin
provokateurin merged commit eab608f into masterMar 25, 2025
@provokateurin
provokateurin deleted the refactor/use-in-instead-of-or branch March 25, 2025 10:52
@marcelklehr

Copy link
Copy Markdown
MemberAuthor

Do we backport this?

@provokateurin

Copy link
Copy Markdown
Member

I'd say no, as nobody has been complaining about these exact queries causing performance problems.
Of course it's still a nice improvement for 32 nevertheless.

@marcelklehr

Copy link
Copy Markdown
MemberAuthor

I have a ticket from a customer where these are problematic among others. They are on 29

@marcelklehr

Copy link
Copy Markdown
MemberAuthor

/backport to stable31

@marcelklehr

Copy link
Copy Markdown
MemberAuthor

/backport to stable30

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

Labels

4. to releaseReady to be released and/or waiting for tests to finishperformance 🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@marcelklehr@provokateurin@come-nc@skjnldsv