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

statement summary: fix typo in statement-summary #6794

Merged
merged 2 commits into from
Aug 3, 2021
Merged
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
8 changes: 4 additions & 4 deletions statement-summary-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ select * from employee where id in (...) and salary between ? and ?;

## `statements_summary_evicted`

`statements_summary` 表的容量受 `tidb_stmt_summary_max_stmt_count` 配置控制,内部使用 LRU 算法,一旦接收到的 SQL 种类超过了 `tidb_stmt_summary_max_stmt_count`,表中最久未被命中的记录就会被驱逐出表。TiDB 引入了 `statements_summary_evicted` 表,该表记录了各个时段被驱逐的 `SQL` 的具体种数
`statements_summary` 表的容量受 `tidb_stmt_summary_max_stmt_count` 配置控制,内部使用 LRU 算法,一旦接收到的 SQL 种类超过了 `tidb_stmt_summary_max_stmt_count`,表中最久未被命中的记录就会被驱逐出表。TiDB 引入了 `statements_summary_evicted` 表,该表记录了各个时段被驱逐 SQL 语句的具体数量

只有当 `SQL` 被 `statement summary` 表驱逐的时候,`statements_summary_evicted` 表的内容才会更新。`statements_summary_evicted` 表仅记录发生驱逐的时间段
只有当 SQL 语句被 `statement summary` 表驱逐的时候,`statements_summary_evicted` 表的内容才会更新。`statements_summary_evicted` 表记录发生驱逐的时间段和被驱逐 SQL 的数量

## statement summary 的 cluster 表

Expand Down Expand Up @@ -121,7 +121,7 @@ set global tidb_stmt_summary_refresh_interval = 1800;
set global tidb_stmt_summary_history_size = 24;
```

以上配置生效后,`statements_summary` 每 30 分钟清空一次。因为 24 * 30 分钟 = 12 小,,所以 `statements_summary_history` 保存最近 12 小时的历史数。`statements_summary_evicted` 保存最近 24 个发生了 evict 的时间段记录;`statements_summary_evicted` 则以 30 分钟为一个记录周期,表容量为 24 个时间段。
以上配置生效后,`statements_summary` 每 30 分钟清空一次,所以 `statements_summary_history` 保存最近 12 小时的历史数。`statements_summary_evicted` 保存最近 24 个发生了 evict 的时间段记录;`statements_summary_evicted` 则以 30 分钟为一个记录周期,表容量为 24 个时间段。

以上几个系统变量都有 global 和 session 两种作用域,它们的生效方式与其他系统变量不一样:

Expand Down Expand Up @@ -176,7 +176,7 @@ select * from information_schema.statements_summary_evicted;
2 row in set (0.001 sec)
```

由上可知,对最多 59 种 SQL 发生了 evict,也就是说最好将 statement summary 的容量增大至少 59 条记录。
由上可知,对最多 59 种 SQL 发生了 evict,也就是说最少应将 statement summary 的容量增大至 59 条记录。

## 目前的限制

Expand Down