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

refactor column stats #21537

Closed
time-and-fate opened this issue Dec 7, 2020 · 1 comment · Fixed by #21817
Closed

refactor column stats #21537

time-and-fate opened this issue Dec 7, 2020 · 1 comment · Fixed by #21817
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@time-and-fate
Copy link
Member

time-and-fate commented Dec 7, 2020

Development Task

Please refer to Index Selection Work Plan for details about the entire project.

This issue record works on column statistics.

  • Introduce stats version field (we're already storing this in mysql.stats_histograms but not used in column stats) to column stats to distinguish old stats and new stats.
  • Use a system variable (will be introduced by sessionctx: add variable tidb_analyze_version #21515) to fall back to the old method.
  • Switch from EncodeValue to EncodeKey because we need topn to be ordered to handle range query.
  • Collect new version stats (no cmsketch + extract topn when building stats from samples)
  • Use new version stats (equal cond: topn + bucket.repeats + uniform distribution assumption for others) (range cond: take topn into consideration)
  • Correctly save/load new stats to/from storage/JSON.

There also will be further tests.

@time-and-fate time-and-fate added the type/enhancement The issue or PR belongs to an enhancement. label Dec 7, 2020
@time-and-fate
Copy link
Member Author

/assign time-and-fate

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

Successfully merging a pull request may close this issue.

1 participant