From e8deeef7b056cc914ea9328a8db50a8d551ad26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E6=89=8B=E6=8E=89=E5=8C=85=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=B8=88?= Date: Wed, 7 Aug 2024 16:11:10 +0800 Subject: [PATCH] statistics: mark NDV as deprecated and update variable scopes (#18499) --- sql-statements/sql-statement-show-stats-buckets.md | 4 ++-- system-variables.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql-statements/sql-statement-show-stats-buckets.md b/sql-statements/sql-statement-show-stats-buckets.md index 6d8540b2adb18..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 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 shows `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) diff --git a/system-variables.md b/system-variables.md index c6c7c9171fc6b..f52d7083c9c1a 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1114,7 +1114,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 @@ -1360,7 +1360,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 @@ -4275,7 +4275,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;