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

feat(statements): show plan_cache_hits field #1598

Merged
merged 1 commit into from
Sep 27, 2023
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
2 changes: 2 additions & 0 deletions pkg/apiserver/statement/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type Model struct {
AggBinaryPlan string `json:"binary_plan" agg:"ANY_VALUE(binary_plan)"`
AggPlanDigest string `json:"plan_digest" agg:"ANY_VALUE(plan_digest)"`
AggPlanHint *string `json:"plan_hint" agg:"ANY_VALUE(plan_hint)"`
AggPlanCacheHits int `json:"plan_cache_hits" agg:"SUM(plan_cache_hits)"`

// RocksDB
AggMaxRocksdbDeleteSkippedCount uint `json:"max_rocksdb_delete_skipped_count" agg:"MAX(max_rocksdb_delete_skipped_count)"`
AggAvgRocksdbDeleteSkippedCount uint `json:"avg_rocksdb_delete_skipped_count" agg:"CAST(SUM(exec_count * avg_rocksdb_delete_skipped_count) / SUM(exec_count) as SIGNED)"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ export interface StatementModel {
* @memberof StatementModel
*/
'plan'?: string;
/**
*
* @type {number}
* @memberof StatementModel
*/
'plan_cache_hits'?: number;
/**
*
* @type {boolean}
Expand Down
3 changes: 3 additions & 0 deletions ui/packages/tidb-dashboard-client/swagger/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5440,6 +5440,9 @@
"description": "deprecated, replaced by BinaryPlanText",
"type": "string"
},
"plan_cache_hits": {
"type": "integer"
},
"plan_can_be_bound": {
"type": "boolean"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export const tabBasicItems = (data: StatementModel) => [
key: 'exec_count',
value: <ValueWithTooltip.Short value={data.exec_count} />
},
{
key: 'plan_cache_hits',
value: <ValueWithTooltip.Short value={data.plan_cache_hits} />
},
{
key: 'sum_latency',
value: getValueFormat('ns')(data.sum_latency || 0, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ statement:
exec_count_tooltip: Total execution count for this kind of statement
plan_count: '# Plans'
plan_count_tooltip: Number of distinct execution plans of this statement in current time range
plan_cache_hits: '# Plan Cache Hits'
plan_cache_hits_tooltip: Number of times the execution plan cache is hit
avg_latency: Mean Latency
avg_latency_tooltip: Execution time of single query
avg_mem: Mean Memory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ statement:
exec_count_tooltip: 该类 SQL 语句在时间段内被执行的总次数
plan_count: 计划数
plan_count_tooltip: 该类 SQL 语句在时间段内的不同执行计划数量
plan_cache_hits: 计划缓存命中次数
plan_cache_hits_tooltip: 该类 SQL 语句在时间段内的计划缓存命中次数
avg_latency: 平均耗时
avg_latency_tooltip: 单条 SQL 查询的执行时间
avg_mem: 平均内存
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export function statementColumns(
maxWidth: 300,
columnActionsMode: ColumnActionsMode.clickable
}),
tcf.bar.single('plan_cache_hits', 'short', rows),
avgMaxColumn(tcf, 'avg_mem', 'bytes', rows),
avgMaxColumn(tcf, 'avg_disk', 'bytes', rows),
errorsWarningsColumn(tcf, rows),
Expand Down
6 changes: 6 additions & 0 deletions ui/packages/tidb-dashboard-lib/src/client/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,12 @@ export interface StatementModel {
* @memberof StatementModel
*/
'plan'?: string;
/**
*
* @type {number}
* @memberof StatementModel
*/
'plan_cache_hits'?: number;
/**
*
* @type {boolean}
Expand Down
Loading