Question(optimizer): why InList be rewritten as a series of OR expressions?
#26589
Replies: 3 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I examined the implementation of DuckDB. For |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Oh! I understand it, we can close this discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In
sql/planner/DomainTranslator.java L876 - L880, we will expand the elements inInListinto an expression composed of multipleORexpressions linked together to form the predicate. Some optimizer rules such asPushPredicateIntoTableScanwill call it.However, I personally consider this to be an unnecessary rewrite, and when
InListcontains a large number of elements, it can significantly slow down the optimizer's processing time (as other optimization rules also call it).In practical testing, when an
InListcontaining 10,000 values was present, the optimizer time collected via logs was approximately 3.5 seconds and rewritten intoORexpressions costs 2.6 seconds.In Datafusion, it will combine multi
ORexpressions into singleInList.So I wonder why such a rewritten rule exists here? Or is this a potential point for optimization?
References
Beta Was this translation helpful? Give feedback.
All reactions