-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: consent cockroachdb perfomance issue with zigzag join query #1790
Conversation
d503fe3
to
5b4798c
Compare
Thank you! The migrations still need to be improved but since @zepatrik is refactoring that at the moment I think it makes sense to include this in his PR / after his merge! |
Hey @lopezator |
@zepatrik What would be exactly the file naming convention? Something related to date? I see that every migration file starts by |
You can either use gobuffalo's soda cli to generate the files or just copy an existing one and increase the number. It is usually of the format |
Ok! Do you prefer empty migrations for I think that this index might not add as much value as it adds for cockroachdb, but as long as there are queries on that table using both fields in the where clause this could be beneficial for them also. Let me know what you think. |
Think you can apply it to all or @aeneasr ? |
apply for all should be ok! |
4e6307f
to
a6d2106
Compare
Cool! PTAL @zepatrik |
right let me fix that I know what the problem is |
It's actually not a problem with the test. |
The question remains: why did the mysql test pass?? |
Add an index over subject and client_id in order to avoid the (sometimes) underperformant zigzag join query. Closes ory#1789 Related to ory#1755 cockroachdb/cockroach#47179
a6d2106
to
f42a070
Compare
Good question 😅 PTAL @zepatrik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @aeneasr
Thank you both for the great work! |
You are welcome @aeneasr ! |
Add an index over subject and client_id in order to avoid the
(sometimes) underperformant zigzag join query.
Closes #1789
Related to #1755 cockroachdb/cockroach#47179
After applying the proposed index, the query plan now avoids the zigzag join query, reducing the query times from 50s to 2s in worst cases in my tests.