From 87f037c1a17b4513a5db8fb9bb91e34cafe5133b Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 6 Aug 2024 14:17:59 +0800 Subject: [PATCH 1/3] statistics: mark NDV as deprecated Signed-off-by: hi-rustin --- sql-statements/sql-statement-show-stats-buckets.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-show-stats-buckets.md b/sql-statements/sql-statement-show-stats-buckets.md index 6d8540b2adb18..a37c41b33e0a3 100644 --- a/sql-statements/sql-statement-show-stats-buckets.md +++ b/sql-statements/sql-statement-show-stats-buckets.md @@ -21,7 +21,7 @@ Currently, the `SHOW STATS_BUCKETS` statement returns the following columns: | `Repeats` | The occurrence number of the maximum value | | `Lower_bound` | The minimum value | | `Upper_bound` | The maximum value | -| `Ndv` | The number of different values in the bucket. When `tidb_analyze_version` = `1`, `Ndv` is always `0`, which has no actual meaning. | +| `Ndv` | The number of distinct values in the bucket. This field is deprecated and always is 0 due to its inaccurate value. | ## Synopsis @@ -61,4 +61,4 @@ This statement is a TiDB extension to MySQL syntax. ## See also * [`ANALYZE`](/sql-statements/sql-statement-analyze-table.md) -* [Introduction to Statistics](/statistics.md) \ No newline at end of file +* [Introduction to Statistics](/statistics.md) From 72a575018b618e1a8d94e6498a27ca5bde0416c1 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 6 Aug 2024 14:25:38 +0800 Subject: [PATCH 2/3] statistics: correct the scopes for some variables Signed-off-by: hi-rustin --- system-variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index f88eddf08f680..1a8f53da65266 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1113,7 +1113,7 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a ### tidb_analyze_distsql_scan_concurrency New in v7.6.0 -- Scope: GLOBAL +- Scope: SESSION | GLOBAL - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Integer @@ -1359,7 +1359,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1; ### tidb_build_sampling_stats_concurrency New in v7.5.0 -- Scope: GLOBAL +- Scope: SESSION | GLOBAL - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Integer @@ -4274,7 +4274,7 @@ mysql> desc select count(distinct a) from test.t; +-----------------------------------+---------+-----------+-----------------------+---------------------------------+ ``` -- The second example uses `0`, which assumes that 0% of rows will be scanned before the qualified rows are found. +- The second example uses `0`, which assumes that 0% of rows will be scanned before the qualified rows are found. ```sql > SET SESSION tidb_opt_ordering_index_selectivity_ratio = 0; From c093b4f0b177e26f1a654c0e27a294df5e24875a Mon Sep 17 00:00:00 2001 From: Aolin Date: Wed, 7 Aug 2024 15:45:50 +0800 Subject: [PATCH 3/3] refine wording --- sql-statements/sql-statement-show-stats-buckets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-show-stats-buckets.md b/sql-statements/sql-statement-show-stats-buckets.md index a37c41b33e0a3..f1df822e205d3 100644 --- a/sql-statements/sql-statement-show-stats-buckets.md +++ b/sql-statements/sql-statement-show-stats-buckets.md @@ -21,7 +21,7 @@ Currently, the `SHOW STATS_BUCKETS` statement returns the following columns: | `Repeats` | The occurrence number of the maximum value | | `Lower_bound` | The minimum value | | `Upper_bound` | The maximum value | -| `Ndv` | The number of distinct values in the bucket. This field is deprecated and always is 0 due to its inaccurate value. | +| `Ndv` | The number of distinct values in the bucket. This field is deprecated and always shows `0` due to its inaccurate value. | ## Synopsis