-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(#1235): add an optimizer switch flag to migration context #1236
base: master
Are you sure you want to change the base?
Conversation
d499039
to
71df3e8
Compare
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.
@cyrinux thanks for the PR! I have left a few comments/nits in line
Two more questions:
- For context/curiosity, in what situations or environments are you needing to override the
optimizer_switch
? This might be useful to know or document - Can you please update
doc/command-line-flags.md
with a description of this new flag?
🙇
I'm not DBA myself, but I understand sometimes we set those I apply your recommandations, is-it better for you ? 🙏 |
462cc89
to
66211ee
Compare
to be able to pass for example: `--optimizer-switch="prefer_ordering_index=on"` Co-authored-by: Tim Vaillancourt <[email protected]>
66211ee
to
eec7aa5
Compare
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.
@cyrinux thanks for the changes! Two more suggestions/questions added on 2nd thought, my apologies.
4c9061b
to
73bbd54
Compare
For people who stumble upon this later on and want to know the reason from a DBA point of view (I worked with Cyril to put this together)... The backstory behind this is that we have a stable application that has been running for over 15 years on Mysql. When we upgraded from 5.7 to 8.0, we observed some severe performance impacts on a certain set of queries. It would have been particularly hard to rewrite them (since they are generated by a query builder that no-one is particularly keen to hack on in case the change introduces other side effects). We worked out that we could recover the original performance (at the expense of marginally slowing a few other types of queries, which was deemed to be an acceptable tradeoff) by setting Fast forward to a recent gh-ost session where an execute would repeatedly crash with
Why? Consider first, a source table:
The table I was trying to ghost was, roughly:
In production, the When explaining the query that gh-ost issued to find the min/max migration values, it became apparent that it was using the index on So yeah tl;dr issuing a |
@cyrinux this fails on 5.7 CI on:
|
As I mentioned above, this was introduced post-GA. So it won't work with
Aurora 2.0. I think this is a bit of a problem because 5.7 is no longer
supported, but Aurora 2.0 is.
…On Fri, Dec 8, 2023, 7:28 p.m. Tim Vaillancourt ***@***.***> wrote:
@cyrinux <https://github.com/cyrinux> this fails on 5.7 CI on:
2023-12-09 02:26:19 FATAL Error 1231: Variable 'optimizer_switch' can't be set to the value of 'prefer_ordering_index=on'
—
Reply to this email directly, view it on GitHub
<#1236 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOE7RZP3VMP55MQKBFAH3YIPEGJAVCNFSM6AAAAAATKIJBZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBYGA4TKNRTGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I would not worry about a CI failure on a version of Mysql that is no longer receiving upstream updates. The last MySQL General Availability version was 5.7.44, released on 2023-10-25. The 5.7 branch is has been End of Life since then. On 8.x you will get a similar error message if you provide a garbage value, so perhaps the best approach is to remind the user to consult the Mysql documentation for the list of values that |
Description
This add a
optimizer_switch
string flag.--optimizer-switch="prefer_ordering_index=on"
I don't check the value, easier to maintains, this will just fail if its a unknown value, depending the mysql/maria/percona version.
Related issue: #1235