-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
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, left a small comment trying to understand the cost for limit
@@ -107,6 +107,11 @@ impl CostModel<OptRelNodeTyp> for OptCostModel { | |||
Self::cost(row_cnt, 0.0, row_cnt) | |||
} | |||
OptRelNodeTyp::PhysicalEmptyRelation => Self::cost(0.5, 0.01, 0.0), | |||
OptRelNodeTyp::PhysicalLimit => { |
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.
Just wondering how is this determined?
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.
I don't fully understand the cost system in play here just yet, but there are a few things to notice:
-The row_cnt
is from the child tuple
- I multiply by selectivity as a very rough estimate for what the cost might be
- usually LIMIT clauses are quite selective, so that is my sketchy reasoning for 0.001. Also, it is the same selectivity as FILTER.
- the computation cost for this one I just set to
row_cnt
. No reasoning really. Looking again at other examples, I think that should probably be compute_cost from the child, so I will change it.
There is probably a cleverer way to do this by actually reading LIMIT, but I think it might be best to leave that for a real cost model.
No description provided.