提交 362c1398 authored 作者: Noel Grandin's avatar Noel Grandin

fix pagestore index calculations

which results in (as far as I can see) quite a few cases where we now pick the faster option of an index instead of scanning over the pagestore table data
上级 fb7e94c8
...@@ -312,8 +312,11 @@ public class PageDataIndex extends PageIndex { ...@@ -312,8 +312,11 @@ public class PageDataIndex extends PageIndex {
public double getCost(Session session, int[] masks, public double getCost(Session session, int[] masks,
TableFilter[] filters, int filter, SortOrder sortOrder, TableFilter[] filters, int filter, SortOrder sortOrder,
AllColumnsForPlan allColumnsSet) { AllColumnsForPlan allColumnsSet) {
// The +200 is so that indexes that can return the same data, but have less columns, will take precedence.
// This all works out easier in the MVStore case, because MVStore uses the same cost calculation
// code for the ScanIndex (i.e. the MVPrimaryIndex) and all other indices.
return 10 * (tableData.getRowCountApproximation() + return 10 * (tableData.getRowCountApproximation() +
Constants.COST_ROW_OFFSET); Constants.COST_ROW_OFFSET) + 200;
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论