File: innodb-index_ucs2.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (126 lines) | stat: -rw-r--r-- 3,798 bytes parent folder | download
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
create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2;
Warnings:
Warning	1287	'ucs2' is deprecated and will be removed in a future release. Please use utf8mb4 instead
insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
commit;
alter table t1 add unique index (b);
ERROR 23000: Duplicate entry '2' for key 't1.b'
insert into t1 values(8,9,'fff','fff');
select * from t1;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int NOT NULL,
  `b` int DEFAULT NULL,
  `c` char(10) DEFAULT NULL,
  `d` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
alter table t1 add index (b);
insert into t1 values(10,10,'kkk','iii');
select * from t1;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
select * from t1 force index(b) order by b;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
explain select * from t1 force index(b) order by b;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	index	NULL	b	5	NULL	6	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` FORCE INDEX (`b`) order by `test`.`t1`.`b`
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int NOT NULL,
  `b` int DEFAULT NULL,
  `c` char(10) DEFAULT NULL,
  `d` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
alter table t1 add unique index (c), add index (d);
insert into t1 values(11,11,'aaa','mmm');
select * from t1;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
11	11	aaa	mmm
select * from t1 force index(b) order by b;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
11	11	aaa	mmm
select * from t1 force index(c) order by c;
a	b	c	d
11	11	aaa	mmm
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
select * from t1 force index(d) order by d;
a	b	c	d
1	1	ab	ab
2	2	ac	ac
3	2	ad	ad
4	4	afe	afe
8	9	fff	fff
10	10	kkk	iii
11	11	aaa	mmm
explain select * from t1 force index(b) order by b;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	index	NULL	b	5	NULL	7	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` FORCE INDEX (`b`) order by `test`.`t1`.`b`
explain select * from t1 force index(c) order by c;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	index	NULL	c	21	NULL	7	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` FORCE INDEX (`c`) order by `test`.`t1`.`c`
explain select * from t1 force index(d) order by d;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	index	NULL	d	43	NULL	7	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` FORCE INDEX (`d`) order by `test`.`t1`.`d`
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int NOT NULL,
  `b` int DEFAULT NULL,
  `c` char(10) DEFAULT NULL,
  `d` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`a`),
  UNIQUE KEY `c` (`c`),
  KEY `b` (`b`),
  KEY `d` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=ucs2
check table t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
drop table t1;