-
Notifications
You must be signed in to change notification settings - Fork 591
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
Optimize large case-when in simple form to constant lookup #14317
Comments
I suggest performing this optimization in the binder phase because it is more straightforward and easier to implement.
|
This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned. |
Some future to-dos:
|
This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned. |
PostgreSQL supports a simple-form case-when expression:
In such case, if there is a large number of arms (e.g. 500+), it's better to optimize it to a constant lookup.
In addition, if users write a case-when expression that can be converted to the simple form, we can also normalize it in optimizer easily:
Note: the corner cases should be covered:
The text was updated successfully, but these errors were encountered: