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
|
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);
CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
EXPLAIN EXTENDED SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1`
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1` where `test`.`v1`.`a` = 1
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1` where `test`.`v1`.`b` > 100
EXPLAIN EXTENDED SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`a` AS `a`,`test`.`v1`.`b` AS `b` from `test`.`v1`
EXPLAIN EXTENDED SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`v1`.`b` AS `b`,`test`.`v1`.`a` AS `a` from `test`.`v1`
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON TABLE
#
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test EXPLAIN EXTENDED SELECT `a` , `b` FROM `test` . `v1` 1
test EXPLAIN EXTENDED SELECT `b` , `a` FROM `test` . `v1` 1
test SELECT * FROM `test` . `v1` 1
test SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test SELECT `a` , `b` FROM `test` . `v1` 1
test SELECT `b` , `a` FROM `test` . `v1` 1
test SHOW WARNINGS 5
test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN EXTENDED SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
EXPLAIN EXTENDED SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 1
EXPLAIN EXTENDED SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` > 100
EXPLAIN EXTENDED SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
EXPLAIN EXTENDED SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1`
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON VIEW
#
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
test CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test DROP TABLE `test` . `v1` 1
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` 2
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test EXPLAIN EXTENDED SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test EXPLAIN EXTENDED SELECT `a` , `b` FROM `test` . `v1` 2
test EXPLAIN EXTENDED SELECT `b` , `a` FROM `test` . `v1` 2
test SELECT * FROM `test` . `v1` 2
test SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test SELECT SCHEMA_NAME , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test SELECT `a` , `b` FROM `test` . `v1` 2
test SELECT `b` , `a` FROM `test` . `v1` 2
test SHOW WARNINGS 10
test TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
CREATE TABLE test.v1 (a int, b int);
INSERT INTO test.v1 VALUES (1, 100), (2, 200), (3, 300);
CREATE TABLE test.t1 (a int, b int);
INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300);
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
EXPLAIN SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE v1 ALL NULL NULL NULL NULL 3
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON TABLE
#
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 1
test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 1
test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 1
test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 1
test a73dca7a09f45de04f1f4588f0a4e19f TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN SELECT * from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT * from test.v1 where a = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT * from test.v1 where b > 100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
EXPLAIN SELECT a, b from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
EXPLAIN SELECT b, a from test.v1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
SELECT * from test.v1;
a b
1 100
2 200
3 300
SELECT * from test.v1 where a = 1;
a b
1 100
SELECT * from test.v1 where b > 100;
a b
2 200
3 300
SELECT a, b from test.v1;
a b
1 100
2 200
3 300
SELECT b, a from test.v1;
b a
100 1
200 2
300 3
#
# DIGESTS SEEN ON VIEW
#
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test 7f6c48fe072a231bc75d6d449978b9f5 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test c24db45ea4beed6ba2537ca6ea2d0484 DROP TABLE `test` . `v1` 1
test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 2
test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 2
test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 7b82ea9a7c1859f76abed712d2d4b14d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 2
test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 2
test a73dca7a09f45de04f1f4588f0a4e19f TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1;
DROP TABLE test.t1;
|