summaryrefslogtreecommitdiffstats
path: root/storage/rocksdb/mysql-test/rocksdb/r/optimizer_loose_index_scans.result
blob: 1fe61fe9fc5584d039526e691fad8ea9efc49105 (plain)
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
set optimizer_switch='index_merge_sort_union=off';
create table t (a int, b int, c int, d int, e int, primary key(a, b, c, d), key(b, d)) engine=rocksdb;
analyze table t;
Table	Op	Msg_type	Msg_text
test.t	analyze	status	OK
show indexes from t;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
t	0	PRIMARY	1	a	A	100	NULL	NULL		LSMTREE		
t	0	PRIMARY	2	b	A	500	NULL	NULL		LSMTREE		
t	0	PRIMARY	3	c	A	2500	NULL	NULL		LSMTREE		
t	0	PRIMARY	4	d	A	2500	NULL	NULL		LSMTREE		
t	1	b	1	b	A	50	NULL	NULL		LSMTREE		
t	1	b	2	d	A	500	NULL	NULL		LSMTREE		
set optimizer_switch = 'skip_scan=off';
explain select b, d from t where d < 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	NULL	b	8	NULL	#	Using where; Using index
rows_read
2500
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select b, d from t where d < 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	b	8	NULL	#	Using where; Using index for skip scan
rows_read
260
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select b, d from t where d > 4;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	NULL	b	8	NULL	#	Using where; Using index
rows_read
2500
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select b, d from t where d > 4;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	b	8	NULL	#	Using where; Using index for skip scan
rows_read
1505
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a = 5 and d <= 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where; Using index
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a = 5 and d <= 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
126
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select e from t where a = 5 and d <= 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select e from t where a = 5 and d <= 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	4	const	#	Using where
rows_read
250
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a = 5 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where; Using index
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a = 5 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
26
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select e from t where a = 5 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select e from t where a = 5 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	4	const	#	Using where
rows_read
250
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a in (1, 5) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY	PRIMARY	4	NULL	#	Using where; Using index
rows_read
500
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a in (1, 5) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
52
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a in (1, 3, 5) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY	PRIMARY	4	NULL	#	Using where; Using index
rows_read
750
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a in (1, 3, 5) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
78
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a in (1, 5) and b in (1, 2) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	8	NULL	#	Using where; Using index
rows_read
200
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a in (1, 5) and b in (1, 2) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
24
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a in (1, 2, 3, 4, 5) and b in (1, 2, 3) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	8	NULL	#	Using where; Using index
rows_read
750
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a in (1, 2, 3, 4, 5) and b in (1, 2, 3) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
90
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a = 5 and b = 2 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	8	const,const	#	Using where; Using index
rows_read
50
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a = 5 and b = 2 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
6
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a+1, b, c, d from t where a = 5 and d < 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where; Using index
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a+1, b, c, d from t where a = 5 and d < 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
101
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select b, c, d from t where a = 5 and d < 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where; Using index
rows_read
250
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select b, c, d from t where a = 5 and d < 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	16	NULL	#	Using where; Using index for skip scan
rows_read
101
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=off';
explain select a, b, c, d from t where a = b and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	NULL	b	8	NULL	#	Using where; Using index
rows_read
2500
set optimizer_switch = 'skip_scan=on,skip_scan_cost_based=off';
explain select a, b, c, d from t where a = b and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	b	8	NULL	#	Using where; Using index for skip scan
rows_read
5
include/diff_tables.inc [temp_orig, temp_skip]
set optimizer_switch = 'skip_scan=off,skip_scan_cost_based=on';
set optimizer_switch = 'skip_scan=on';
set optimizer_trace = 'enabled=on';
explain select a, b, c, d from t where a = 5 and d < 3 order by b, c, d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	4	const	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%order_attribute_not_prefix_in_index%';
count(*)
1
explain select a, b, c, d from t where a = 2 and d >= 98 and e = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY	PRIMARY	4	const	#	Using where
select count(*) from information_schema.optimizer_trace where trace like '%query_references_nonkey_column%';
count(*)
1
explain select a, b, c, d from t where a = 5 or b = 2 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	PRIMARY,b	b	8	NULL	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%no_range_tree%';
count(*)
1
explain select a, b, c, d from t where a = 5 or b = 2 or d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	PRIMARY,b	b	8	NULL	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%no_range_tree%';
count(*)
1
explain select a, b, c, d from t where a = 5 or d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	index	PRIMARY,b	b	8	NULL	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%no_range_tree%';
count(*)
1
explain select a, b, c, d from t where ((a = 5 and b = 2) or a = 2) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	b	8	NULL	#	Using where; Using index for skip scan
select count(*) from information_schema.optimizer_trace where trace like '%keypart_in_disjunctive_query%';
count(*)
1
explain select a, b, c, d from t where a > 2 and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	4	NULL	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%prefix_not_const_equality%';
count(*)
1
explain select a, b, c, d from t where a = 2 and (d >= 98 or d < 2);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	4	const	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%range_predicate_too_complex%';
count(*)
1
explain select a, b, c, d from t where a = 2 and b = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	8	const,const	#	Using index
select count(*) from information_schema.optimizer_trace where trace like '%no_range_predicate%';
count(*)
1
explain select a, b, c, d from t where a = 2 and c > 2 and d < 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	ref	PRIMARY,b	PRIMARY	4	const	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%too_many_range_predicates%';
count(*)
1
explain select a, b, c, d from t where (a < 1 or a = 4 or a = 5) and b in (1, 2, 3) and d >= 98;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t	range	PRIMARY,b	PRIMARY	8	NULL	#	Using where; Using index
select count(*) from information_schema.optimizer_trace where trace like '%prefix_not_const_equality%';
count(*)
1
set optimizer_trace = 'enabled=off';
set optimizer_switch= 'skip_scan=off';
drop table t;
set optimizer_switch='index_merge_sort_union=on';