惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
博客园_首页
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
宝玉的分享
宝玉的分享

祈雨的笔记

安全多方计算MPC spark原理解析 kueue执行源码分析 spark on k8s执行源码分析 spark-operator源码解析 系统压测遇到的缓存击穿问题 我的世界PC与安卓联机 蚂蚁金服流量投放平台的AIG改造 G1大对象致Old区占用率高 日志打印导致接口响应率下跌分析 Groovy加载类导致OOM分析 ERROR日志打印导致CPU满载 记OceanBase死锁超时 应用发版期间服务响应超时 Ark Serverless初探 系统优化复盘一二三 The user specified as a definer does not exist Kong网关初探 API网关选型调研 CPU火焰图常用工具 配置中心选型调研 root操作Nginx导致用户组错误 基于Proxifier使用代理 FastJSON字段智能匹配踩坑 Nacos初探 记一次Nginx服务器CPU满荷载故障 基于券系统分库分表的思考 limit不参与SQL成本计算致索引失效 Linux常用性能监控命令 golang低版本http2偶现400
optimizer tracing
祈雨的笔记 · 2019-04-06 · via 祈雨的笔记
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
{
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select `user`.`id` AS `id`,`user`.`name` AS `name`,`user`.`age` AS `age`,`user`.`city` AS `city` from `user` where ((`user`.`name` = 'tom') and (`user`.`age` = 23)) order by `user`.`city`"
}
]
}
},
{
"join_optimization": {
"select#": 1,
"steps": [
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "((`user`.`name` = 'tom') and (`user`.`age` = 23))",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "((`user`.`name` = 'tom') and multiple equal(23, `user`.`age`))"
},
{
"transformation": "constant_propagation",
"resulting_condition": "((`user`.`name` = 'tom') and multiple equal(23, `user`.`age`))"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "((`user`.`name` = 'tom') and multiple equal(23, `user`.`age`))"
}
]
}
},
{
"substitute_generated_columns": {}
},
{
"table_dependencies": [
{
"table": "`user`",
"row_may_be_null": false,
"map_bit": 0,
"depends_on_map_bits": []
}
]
},
{
"ref_optimizer_key_uses": [
{
"table": "`user`",
"field": "name",
"equals": "'tom'",
"null_rejecting": false
},
{
"table": "`user`",
"field": "age",
"equals": "23",
"null_rejecting": false
}
]
},
{
"rows_estimation": [ // 预估不同表访问方法的访问成本
{
"table": "`user`",
"range_analysis": {
"table_scan": { // 全表扫描的行数和成本
"rows": 5,
"cost": 4.1
},
"potential_range_indexes": [ // 分析可能使用的索引
{ // 主键索引不可用
"index": "PRIMARY",
"usable": false,
"cause": "not_applicable"
},
{ // name索引可用
"index": "name",
"usable": true,
"key_parts": [
"name",
"id"
]
},
{ // age索引可用
"index": "age",
"usable": true,
"key_parts": [
"age",
"id"
]
}
],
"setup_range_conditions": [],
"group_index_range": {
"chosen": false,
"cause": "not_group_by_or_distinct"
},
"analyzing_range_alternatives": { // 分析各种可能使用的索引的成本
"range_scan_alternatives": [
{
"index": "name",
"ranges": [
"tom <= name <= tom"
],
"index_dives_for_eq_ranges": true,
"rowid_ordered": true,
"using_mrr": false,
"index_only": false, // 是否索引覆盖
"rows": 2, // 使用该索引获取的记录条数
"cost": 3.41, // 使用该索引的成本
"chosen": true // 是否使用该索引
},
{
"index": "age",
"ranges": [
"23 <= age <= 23"
],
"index_dives_for_eq_ranges": true,
"rowid_ordered": true,
"using_mrr": false,
"index_only": false,
"rows": 2,
"cost": 3.41,
"chosen": false,
"cause": "cost"
}
],
"analyzing_roworder_intersect": { // 分析使用索引合并的成本
"intersecting_indexes": [
{
"index": "name",
"index_scan_cost": 1.0135,
"cumulated_index_scan_cost": 1.0135,
"disk_sweep_cost": 1.75,
"cumulated_total_cost": 2.7635,
"usable": true,
"matching_rows_now": 2,
"isect_covering_with_this_index": false,
"chosen": true
},
{
"index": "age",
"index_scan_cost": 1.001,
"cumulated_index_scan_cost": 2.0145,
"disk_sweep_cost": 0,
"cumulated_total_cost": 2.0145,
"usable": true,
"matching_rows_now": 0.8,
"isect_covering_with_this_index": false,
"chosen": true
}
],
"clustered_pk": {
"clustered_pk_added_to_intersect": false,
"cause": "no_clustered_pk_index"
},
"rows": 1,
"cost": 2.0145,
"covering": false,
"chosen": true
}
},
"chosen_range_access_summary": { // 最佳查询方案
"range_access_plan": {
"type": "index_roworder_intersect",
"rows": 1,
"cost": 2.0145,
"covering": false,
"clustered_pk_scan": false,
"intersect_of": [
{
"type": "range_scan",
"index": "name",
"rows": 2,
"ranges": [
"tom <= name <= tom"
]
},
{
"type": "range_scan",
"index": "age",
"rows": 2,
"ranges": [
"23 <= age <= 23"
]
}
]
},
"rows_for_plan": 1,
"cost_for_plan": 2.0145,
"chosen": true
}
}
}
]
},
{
"considered_execution_plans": [
{
"plan_prefix": [],
"table": "`user`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "ref",
"index": "name",
"rows": 2,
"cost": 2.4,
"chosen": true
},
{
"access_type": "ref",
"index": "age",
"rows": 2,
"cost": 2.4,
"chosen": false
},
{
"rows_to_scan": 1,
"access_type": "range",
"range_details": {
"used_index": "intersect(name,age)"
},
"resulting_rows": 1,
"cost": 2.2145,
"chosen": true,
"use_tmp_table": true
}
]
},
"condition_filtering_pct": 100,
"rows_for_plan": 1,
"cost_for_plan": 2.2145,
"sort_cost": 1,
"new_cost_for_plan": 3.2145,
"chosen": true
}
]
},
{
"attaching_conditions_to_tables": {
"original_condition": "((`user`.`age` = 23) and (`user`.`name` = 'tom'))",
"attached_conditions_computation": [],
"attached_conditions_summary": [
{
"table": "`user`",
"attached": "((`user`.`age` = 23) and (`user`.`name` = 'tom'))"
}
]
}
},
{
"clause_processing": {
"clause": "ORDER BY",
"original_clause": "`user`.`city`",
"items": [
{
"item": "`user`.`city`"
}
],
"resulting_clause_is_simple": true,
"resulting_clause": "`user`.`city`"
}
},
{
"refine_plan": [
{
"table": "`user`"
}
]
}
]
}
},
{
"join_execution": {
"select#": 1,
"steps": [
{
"filesort_information": [
{
"direction": "asc",
"table": "`user`",
"field": "city"
}
],
"filesort_priority_queue_optimization": {
"usable": false,
"cause": "not applicable (no LIMIT)"
},
"filesort_execution": [],
"filesort_summary": {
"rows": 1,
"examined_rows": 1,
"number_of_tmp_files": 0,
"sort_buffer_size": 261880,
"sort_mode": "<sort_key, packed_additional_fields>"
}
}
]
}
}
]
}