Closed xuyifangreeneyes closed 3 years ago
[REVIEW NOTIFICATION]
This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer
in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer
in the comment to help you merge this pull request.
The full list of commands accepted by this bot can be found here.
/cc @winoros
What are predicate columns? https://docs.aws.amazon.com/redshift/latest/dg/r_ANALYZE.html?
ANALYZE TABLE t COLUMNS a, b, c
and ANALYZE TABLE t UPDATE HISTOGRAM ON a, b, c
?ANALYZE TABLE t PERSISTENT FOR COLUMNS (a, b, c);
?
- what is the difference between
ANALYZE TABLE t COLUMNS a, b, c
andANALYZE TABLE t UPDATE HISTOGRAM ON a, b, c
?- how about the MariaDB syntax
ANALYZE TABLE t PERSISTENT FOR COLUMNS (a, b, c);
?
ANALYZE TABLE t UPDATE HISTOGRAM
is compatible with MySQL. Currently we only implement it in parser but don't implement it in tidb (see https://github.com/pingcap/tidb/issues/27666). The behavior of ANALYZE TABLE t UPDATE HISTOGRAM
may need discussion (do we only collect Histogram
? or we also collect other statistics such as CMSketch
, TopN
, FMSketch
?), which is due to different implementations of ANALYZE and statistics between TiDB and MySQL. As for ANALYZE TABLE t COLUMN a, b, c
, we collect all the statistics including Histogram
, TopN
and so on.ANALYZE TABLE t COLUMN a,b,c
refers to TiDB's ANALYZE TABLE t INDEX idx1, idx2
and ANALYZE TABLE t PARTITION p1, p2
. The MariaDB syntax also looks fine to me while maybe PERSISTENT
seems redundant since all the statistics is persistent in TiDB./cc @chrysan @qw4990
@xuyifangreeneyes: PR needs rebase.
/cc @xiongjiwei @morgo
Since parser has been moved into tidb repo, I close it.
What problem does this PR solve?
Related Issue: https://github.com/pingcap/tidb/issues/27828
Support syntax like
ANALYZE TABLE t PREDICATE COLUMNS
andANALYZE TABLE t COLUMNS c1 [, c2] ...
. Related tidb pr: https://github.com/pingcap/tidb/pull/27802What is changed and how it works?
Support syntax like
ANALYZE TABLE t PREDICATE COLUMNS
andANALYZE TABLE t COLUMNS c1 [, c2] ...
andSHOW COLUMN_STATS_USAGE (WHERE/LIKE ...)
.Check List
Tests
Code changes
Side effects
Related changes