Skip to content

Commit

Permalink
statistics: mark NDV as deprecated and update variable scopes (#18499)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 authored Aug 7, 2024
1 parent 1ad12e6 commit e8deeef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions sql-statements/sql-statement-show-stats-buckets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
* [Introduction to Statistics](/statistics.md)
6 changes: 3 additions & 3 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ MPP is a distributed computing framework provided by the TiFlash engine, which a
### tidb_analyze_distsql_scan_concurrency <span class="version-mark">New in v7.6.0</span>
- Scope: GLOBAL
- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
Expand Down Expand Up @@ -1360,7 +1360,7 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;

### tidb_build_sampling_stats_concurrency <span class="version-mark">New in v7.5.0</span>

- Scope: GLOBAL
- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No
- Type: Integer
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e8deeef

Please sign in to comment.