Skip to content
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

Some implementation detail of row count estimation is faulty #28030

Open
time-and-fate opened this issue Sep 14, 2021 · 1 comment
Open

Some implementation detail of row count estimation is faulty #28030

time-and-fate opened this issue Sep 14, 2021 · 1 comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@time-and-fate
Copy link
Member

Enhancement

  1. In (ds *DataSource) DeriveStats, we first call fillIndexPath() then call Selectivity(). This means we first calculate necessary information for every index access path then in Selectivity() we'll use them. However, the information for the primary index access path of a clustered table is calculated in deriveTablePathStats(), which is after calling Selectivity().
    We need to reorder this logic.
  2. In crossValidationSelectivity(), we use the lowExclude and the highExclude from idxPointRange. But the idxPointRange may not be the range of a "point". From (coll *HistColl) getIndexRowCount, it can be a "range" (e.g. a multi-column Range where first several columns are "point" and others are "range"). So it's possible that the lowExclude and highExclude are both true, which makes the crossValidationSelectivity() wrongly return 0.
    I think the simplist fix would be setting the lowExclude and the highExclude to false in crossValidationSelectivity().
@time-and-fate time-and-fate added the type/enhancement The issue or PR belongs to an enhancement. label Sep 14, 2021
@time-and-fate
Copy link
Member Author

/sig planner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants