File: order_by_optimizer.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (30 lines) | stat: -rw-r--r-- 1,363 bytes parent folder | download | duplicates (6)
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
drop table if exists t0,t1,t2,t3;
# 
# MDEV-7885: EXPLAIN shows wrong info for ORDER BY query
# 
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (key1 int, col1 int, key(key1));
insert into t2 select a,a from t0;
insert into t2 select 15,15 from t1;
alter table t2 add key2 int, add key(key2);
# This must show "Using filesort":
explain 
select * from t2 ignore index for order by (key1) where col1<0 order by key1 limit 10;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	1010	Using where; Using filesort
drop table t0, t1, t2;
# 
# MDEV-8857: [Upstream too] EXPLAIN incorrectly shows Distinct for tables using join buffer
# 
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, filler char(200), key(a));
insert into t1 select A.a + B.a* 10, 'AAAAAAAAAAAAAAAAAAAA' from t0 A, t0 B where B.a in (0,1);
explain select distinct A.a from t0 A, t1 B where A.a+B.a> 0;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	A	ALL	NULL	NULL	NULL	NULL	10	Using temporary
1	SIMPLE	B	index	NULL	a	5	NULL	20	Using where; Using index; Using join buffer (flat, BNL join)
drop table t0, t1;