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

statistics: mark NDV as deprecated and update variable scopes #18499

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading