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

[optimizer][CBO] count(*) with table statistics #914

Closed
BohuTANG opened this issue Jun 26, 2021 · 1 comment · Fixed by #960
Closed

[optimizer][CBO] count(*) with table statistics #914

BohuTANG opened this issue Jun 26, 2021 · 1 comment · Fixed by #960
Assignees
Labels

Comments

@BohuTANG
Copy link
Member

BohuTANG commented Jun 26, 2021

Summary

For query select count(*) from system.numbers(100000), ReadDataSourcePlan has Statistics:
https://github.com/datafuselabs/datafuse/blob/28c8e3eda9fb8de881635343d3225b3e7be07b4b/common/planners/src/plan_read_datasource.rs#L17-L26

In this case, we can use the read_rows as the final count:
https://github.com/datafuselabs/datafuse/blob/28c8e3eda9fb8de881635343d3225b3e7be07b4b/common/planners/src/plan_statistics.rs#L6-L11

We need a StatisticsConstant optimizer rule, like:
https://github.com/apache/arrow-datafusion/pull/620/files

@BohuTANG BohuTANG added the C-feature Category: feature label Jun 26, 2021
@BohuTANG BohuTANG added this to the v0.5 milestone Jun 26, 2021
@TennyZhuang
Copy link
Contributor

/assignme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants