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

Revise plan stats on changing partition prune mode #37535

Closed
Yisaer opened this issue Sep 1, 2022 · 2 comments
Closed

Revise plan stats on changing partition prune mode #37535

Yisaer opened this issue Sep 1, 2022 · 2 comments
Assignees
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@Yisaer
Copy link
Contributor

Yisaer commented Sep 1, 2022

Enhancement

Currently, if we change tidb_partition_mode into dynamic from static, and execute query for a partition table without analyzing table for generating global stats. Optimizer will think the table stats as pseudo and provide a bad plan.

To revise this behavior, Optimizer can still think table stats as static for the partition table which has no global stats.

@Yisaer Yisaer added the type/enhancement The issue or PR belongs to an enhancement. label Sep 1, 2022
@Yisaer Yisaer self-assigned this Sep 1, 2022
@Yisaer Yisaer added the sig/planner SIG: Planner label Sep 1, 2022
ti-chi-bot pushed a commit that referenced this issue Sep 8, 2022
@mjonss
Copy link
Contributor

mjonss commented Sep 8, 2022

@Yisaer, how about we always create both per partition and global statistics for partitioned tables, as long as we support both static and dynamic tidb_partition_prune_mode?

@Yisaer
Copy link
Contributor Author

Yisaer commented Sep 9, 2022

@mjonss I think this is a good idea, partition table can be always generated global stats and partition stats without considering prune mode. prune_mode should only affect the behavior of the optimizer, instead of analyzing. I will discuss this idea with PM later.

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