Skip to content

Commit 0629711

Browse files
committed
MDEV-26572 Improve simple multibyte collation performance on the ASCII range
1 parent 4be3661 commit 0629711

29 files changed

+2621
-22
lines changed

mysql-test/include/ctype_ascii_order.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ drop table if exists t1;
44

55
create table t1 select repeat('a',10) as c1;
66
delete from t1;
7+
insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
8+
insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
79
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
810
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
911
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
1012
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
1113
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
1214
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
13-
SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
15+
create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
16+
select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
17+
SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
1418
drop table t1;
19+
drop view v1;

mysql-test/main/ctype_big5.result

Lines changed: 191 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,53 @@ DROP TABLE t1;
246246
drop table if exists t1;
247247
create table t1 select repeat('a',10) as c1;
248248
delete from t1;
249+
insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
250+
insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
249251
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
250252
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
251253
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
252254
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
253255
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
254256
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
255-
SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
256-
GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
257+
create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
258+
select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
259+
column_name collation_name
260+
c1 big5_chinese_ci
261+
name big5_chinese_ci
262+
SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
263+
GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
264+
<00> 00
265+
<01> 01
266+
<02> 02
267+
<03> 03
268+
<04> 04
269+
<05> 05
270+
<06> 06
271+
<07> 07
272+
<08> 08
273+
<09> 09
274+
<0A> 0A
275+
<0B> 0B
276+
<0C> 0C
277+
<0D> 0D
278+
<0E> 0E
279+
<0F> 0F
280+
<10> 10
281+
<11> 11
282+
<12> 12
283+
<13> 13
284+
<14> 14
285+
<15> 15
286+
<16> 16
287+
<17> 17
288+
<18> 18
289+
<19> 19
290+
<1A> 1A
291+
<1B> 1B
292+
<1C> 1C
293+
<1D> 1D
294+
<1E> 1E
295+
<1F> 1F
257296
20
258297
! 21
259298
" 22
@@ -321,8 +360,9 @@ _ 5F
321360
{ 7B
322361
| 7C
323362
} 7D
324-
 7F
363+
<7F> 7F
325364
drop table t1;
365+
drop view v1;
326366
SELECT strcmp('a','a '), strcmp('a ','a');
327367
strcmp('a','a ') strcmp('a ','a')
328368
0 0
@@ -479,6 +519,154 @@ a hex(b) c
479519
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
480520
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
481521
DROP TABLE t1;
522+
drop table if exists t1;
523+
create table t1 select repeat('a',10) as c1;
524+
delete from t1;
525+
insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
526+
insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
527+
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
528+
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
529+
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
530+
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
531+
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
532+
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
533+
create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
534+
select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
535+
column_name collation_name
536+
c1 big5_bin
537+
name big5_bin
538+
SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
539+
GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
540+
<00> 00
541+
<01> 01
542+
<02> 02
543+
<03> 03
544+
<04> 04
545+
<05> 05
546+
<06> 06
547+
<07> 07
548+
<08> 08
549+
<09> 09
550+
<0A> 0A
551+
<0B> 0B
552+
<0C> 0C
553+
<0D> 0D
554+
<0E> 0E
555+
<0F> 0F
556+
<10> 10
557+
<11> 11
558+
<12> 12
559+
<13> 13
560+
<14> 14
561+
<15> 15
562+
<16> 16
563+
<17> 17
564+
<18> 18
565+
<19> 19
566+
<1A> 1A
567+
<1B> 1B
568+
<1C> 1C
569+
<1D> 1D
570+
<1E> 1E
571+
<1F> 1F
572+
20
573+
! 21
574+
" 22
575+
# 23
576+
$ 24
577+
% 25
578+
& 26
579+
' 27
580+
( 28
581+
) 29
582+
* 2A
583+
+ 2B
584+
, 2C
585+
- 2D
586+
. 2E
587+
/ 2F
588+
0 30
589+
1 31
590+
2 32
591+
3 33
592+
4 34
593+
5 35
594+
6 36
595+
7 37
596+
8 38
597+
9 39
598+
: 3A
599+
; 3B
600+
< 3C
601+
= 3D
602+
> 3E
603+
? 3F
604+
@ 40
605+
A 41
606+
B 42
607+
C 43
608+
D 44
609+
E 45
610+
F 46
611+
G 47
612+
H 48
613+
I 49
614+
J 4A
615+
K 4B
616+
L 4C
617+
M 4D
618+
N 4E
619+
O 4F
620+
P 50
621+
Q 51
622+
R 52
623+
S 53
624+
T 54
625+
U 55
626+
V 56
627+
W 57
628+
X 58
629+
Y 59
630+
Z 5A
631+
[ 5B
632+
\ 5C
633+
] 5D
634+
^ 5E
635+
_ 5F
636+
` 60
637+
a 61
638+
b 62
639+
c 63
640+
d 64
641+
e 65
642+
f 66
643+
g 67
644+
h 68
645+
i 69
646+
j 6A
647+
k 6B
648+
l 6C
649+
m 6D
650+
n 6E
651+
o 6F
652+
p 70
653+
q 71
654+
r 72
655+
s 73
656+
t 74
657+
u 75
658+
v 76
659+
w 77
660+
x 78
661+
y 79
662+
z 7A
663+
{ 7B
664+
| 7C
665+
} 7D
666+
~ 7E
667+
<7F> 7F
668+
drop table t1;
669+
drop view v1;
482670
SELECT strcmp('a','a '), strcmp('a ','a');
483671
strcmp('a','a ') strcmp('a ','a')
484672
0 0

mysql-test/main/ctype_big5.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SET collation_connection='big5_bin';
2424
-- source include/ctype_innodb_like.inc
2525
-- source include/ctype_like_escape.inc
2626
-- source include/ctype_like_range_f1f2.inc
27+
-- source include/ctype_ascii_order.inc
2728
-- source include/ctype_pad_space.inc
2829

2930
#

0 commit comments

Comments
 (0)