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

Fix AddJoinTableFilter performance #689

Merged
merged 1 commit into from
Jul 16, 2023

Conversation

InfiniteStash
Copy link
Collaborator

@InfiniteStash InfiniteStash commented Jul 16, 2023

The old implementation using WHERE EXISTS (...) relied on postgres optimizing the query into a JOIN () ON. Unfortunately, it doesn't seem to do so consistently, and the scene pairings query in particular had terrible performance.

Rewriting into a JOIN is tedious since the query builder doesn't really support joins so we have to concat them and sort the filters so args don't get mixed up. I've tested all paths though, and they should work correctly.

@InfiniteStash InfiniteStash merged commit bdccda7 into stashapp:master Jul 16, 2023
2 checks passed
@InfiniteStash InfiniteStash deleted the fix-query-performance branch July 16, 2023 14:26
feederbox826 pushed a commit to feederbox826/stash-box that referenced this pull request Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant