- 5.7.22 rm -rf 95991 bin/mysqld-debug --initialize-insecure --basedir=$PWD --datadir=$PWD/95991 --log-error-verbosity=3 bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/95991 --core-file --socket=/tmp/mysql_ushastry.sock --port=3333 --log-error=$PWD/95991/log.err --log-error-verbosity=3 --secure-file-priv=/tmp/ 2>&1 & bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.22-debug MySQL Community Server - Debug (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `t_orderby4` ( -> `id1` int(11) NOT NULL, -> `id2` int(11) NOT NULL, -> `id3` varchar(64) COLLATE utf8_bin NOT NULL, -> `id4` int(11) DEFAULT NULL, -> `id5` int(11) DEFAULT NULL, -> `id6` varchar(64) COLLATE utf8_bin DEFAULT NULL, -> PRIMARY KEY (`id1`,`id2`,`id3`), -> KEY `id4` (`id4`,`id5`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; Query OK, 0 rows affected (0.01 sec) mysql> load data infile '/tmp/t_orderby4.csv' into table t_orderby4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 100000 rows affected (19.92 sec) Records: 100000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set session debug="d,compare_end_range"; Query OK, 0 rows affected (0.00 sec) mysql> select * from t_orderby4 where id1>1 and id1<5; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 2 | 301 | abc15002 | 1002 | 1102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15302 | | 2 | 301 | abc2 | 2 | 102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh302 | | 2 | 301 | abc30002 | 2002 | 2102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30302 | | 2 | 301 | abc45002 | 3002 | 3102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45302 | | 2 | 301 | abc60002 | 4002 | 4102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60302 | | 2 | 301 | abc75002 | 5002 | 5102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75302 | | 2 | 301 | abc90002 | 6002 | 6102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90302 | | 2 | 1301 | abc10002 | 3002 | 768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10302 | | 2 | 1301 | abc25002 | 4002 | 1768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25302 | | 2 | 1301 | abc40002 | 5002 | 2768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40302 | | 2 | 1301 | abc55002 | 6002 | 3768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55302 | | 2 | 1301 | abc70002 | 2 | 4768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70302 | | 2 | 1301 | abc85002 | 1002 | 5768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85302 | | 2 | 2301 | abc20002 | 6002 | 1435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20302 | | 2 | 2301 | abc35002 | 2 | 2435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35302 | | 2 | 2301 | abc50002 | 1002 | 3435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50302 | | 2 | 2301 | abc5002 | 5002 | 435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5302 | | 2 | 2301 | abc65002 | 2002 | 4435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65302 | | 2 | 2301 | abc80002 | 3002 | 5435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80302 | | 2 | 2301 | abc95002 | 4002 | 6435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95302 | | 3 | 302 | abc15003 | 1003 | 1103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15303 | | 3 | 302 | abc3 | 3 | 103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh303 | | 3 | 302 | abc30003 | 2003 | 2103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30303 | | 3 | 302 | abc45003 | 3003 | 3103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45303 | | 3 | 302 | abc60003 | 4003 | 4103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60303 | | 3 | 302 | abc75003 | 5003 | 5103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75303 | | 3 | 302 | abc90003 | 6003 | 6103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90303 | | 3 | 1302 | abc10003 | 3003 | 769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10303 | | 3 | 1302 | abc25003 | 4003 | 1769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25303 | | 3 | 1302 | abc40003 | 5003 | 2769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40303 | | 3 | 1302 | abc55003 | 6003 | 3769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55303 | | 3 | 1302 | abc70003 | 3 | 4769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70303 | | 3 | 1302 | abc85003 | 1003 | 5769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85303 | | 3 | 2302 | abc20003 | 6003 | 1436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20303 | | 3 | 2302 | abc35003 | 3 | 2436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35303 | | 3 | 2302 | abc50003 | 1003 | 3436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50303 | | 3 | 2302 | abc5003 | 5003 | 436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5303 | | 3 | 2302 | abc65003 | 2003 | 4436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65303 | | 3 | 2302 | abc80003 | 3003 | 5436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80303 | | 3 | 2302 | abc95003 | 4003 | 6436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95303 | | 4 | 303 | abc15004 | 1004 | 1104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15304 | | 4 | 303 | abc30004 | 2004 | 2104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30304 | | 4 | 303 | abc4 | 4 | 104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh304 | | 4 | 303 | abc45004 | 3004 | 3104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45304 | | 4 | 303 | abc60004 | 4004 | 4104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60304 | | 4 | 303 | abc75004 | 5004 | 5104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75304 | | 4 | 303 | abc90004 | 6004 | 6104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90304 | | 4 | 1303 | abc10004 | 3004 | 770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10304 | | 4 | 1303 | abc25004 | 4004 | 1770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25304 | | 4 | 1303 | abc40004 | 5004 | 2770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40304 | | 4 | 1303 | abc55004 | 6004 | 3770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55304 | | 4 | 1303 | abc70004 | 4 | 4770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70304 | | 4 | 1303 | abc85004 | 1004 | 5770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85304 | | 4 | 2303 | abc20004 | 6004 | 1437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20304 | | 4 | 2303 | abc35004 | 4 | 2437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35304 | | 4 | 2303 | abc50004 | 1004 | 3437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50304 | | 4 | 2303 | abc5004 | 5004 | 437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5304 | | 4 | 2303 | abc65004 | 2004 | 4437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65304 | | 4 | 2303 | abc80004 | 3004 | 5437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80304 | | 4 | 2303 | abc95004 | 4004 | 6437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95304 | +-----+------+----------+------+------+---------------------------------------+ 60 rows in set (0.02 sec) mysql> select * from t_orderby4 where id1 = 1 for update; +-----+-----+------+------+------+-------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+-----+------+------+------+-------------------------------------+ | 1 | 300 | abc1 | 1 | 101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh301 | +-----+-----+------+------+------+-------------------------------------+ 1 row in set (0.00 sec) mysql> select count(*) from t_orderby4 where id1 = 1 ; +----------+ | count(*) | +----------+ | 20 | +----------+ 1 row in set (0.00 sec) - 5.7.23 bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.23-debug MySQL Community Server - Debug (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `t_orderby4` ( -> `id1` int(11) NOT NULL, -> `id2` int(11) NOT NULL, -> `id3` varchar(64) COLLATE utf8_bin NOT NULL, -> `id4` int(11) DEFAULT NULL, -> `id5` int(11) DEFAULT NULL, -> `id6` varchar(64) COLLATE utf8_bin DEFAULT NULL, -> PRIMARY KEY (`id1`,`id2`,`id3`), -> KEY `id4` (`id4`,`id5`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; Query OK, 0 rows affected (0.02 sec) mysql> load data infile '/tmp/t_orderby4.csv' into table t_orderby4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 100000 rows affected (19.68 sec) Records: 100000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set session debug="d,compare_end_range"; Query OK, 0 rows affected (0.00 sec) mysql> select * from t_orderby4 where id1>1 and id1<5; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 2 | 301 | abc15002 | 1002 | 1102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15302 | | 2 | 301 | abc2 | 2 | 102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh302 | | 2 | 301 | abc30002 | 2002 | 2102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30302 | | 2 | 301 | abc45002 | 3002 | 3102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45302 | | 2 | 301 | abc60002 | 4002 | 4102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60302 | | 2 | 301 | abc75002 | 5002 | 5102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75302 | | 2 | 301 | abc90002 | 6002 | 6102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90302 | | 2 | 1301 | abc10002 | 3002 | 768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10302 | | 2 | 1301 | abc25002 | 4002 | 1768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25302 | | 2 | 1301 | abc40002 | 5002 | 2768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40302 | | 2 | 1301 | abc55002 | 6002 | 3768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55302 | | 2 | 1301 | abc70002 | 2 | 4768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70302 | | 2 | 1301 | abc85002 | 1002 | 5768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85302 | | 2 | 2301 | abc20002 | 6002 | 1435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20302 | | 2 | 2301 | abc35002 | 2 | 2435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35302 | | 2 | 2301 | abc50002 | 1002 | 3435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50302 | | 2 | 2301 | abc5002 | 5002 | 435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5302 | | 2 | 2301 | abc65002 | 2002 | 4435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65302 | | 2 | 2301 | abc80002 | 3002 | 5435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80302 | | 2 | 2301 | abc95002 | 4002 | 6435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95302 | | 3 | 302 | abc15003 | 1003 | 1103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15303 | | 3 | 302 | abc3 | 3 | 103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh303 | | 3 | 302 | abc30003 | 2003 | 2103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30303 | | 3 | 302 | abc45003 | 3003 | 3103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45303 | | 3 | 302 | abc60003 | 4003 | 4103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60303 | | 3 | 302 | abc75003 | 5003 | 5103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75303 | | 3 | 302 | abc90003 | 6003 | 6103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90303 | | 3 | 1302 | abc10003 | 3003 | 769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10303 | | 3 | 1302 | abc25003 | 4003 | 1769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25303 | | 3 | 1302 | abc40003 | 5003 | 2769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40303 | | 3 | 1302 | abc55003 | 6003 | 3769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55303 | | 3 | 1302 | abc70003 | 3 | 4769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70303 | | 3 | 1302 | abc85003 | 1003 | 5769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85303 | | 3 | 2302 | abc20003 | 6003 | 1436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20303 | | 3 | 2302 | abc35003 | 3 | 2436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35303 | | 3 | 2302 | abc50003 | 1003 | 3436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50303 | | 3 | 2302 | abc5003 | 5003 | 436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5303 | | 3 | 2302 | abc65003 | 2003 | 4436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65303 | | 3 | 2302 | abc80003 | 3003 | 5436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80303 | | 3 | 2302 | abc95003 | 4003 | 6436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95303 | | 4 | 303 | abc15004 | 1004 | 1104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15304 | | 4 | 303 | abc30004 | 2004 | 2104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30304 | | 4 | 303 | abc4 | 4 | 104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh304 | | 4 | 303 | abc45004 | 3004 | 3104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45304 | | 4 | 303 | abc60004 | 4004 | 4104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60304 | | 4 | 303 | abc75004 | 5004 | 5104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75304 | | 4 | 303 | abc90004 | 6004 | 6104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90304 | | 4 | 1303 | abc10004 | 3004 | 770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10304 | | 4 | 1303 | abc25004 | 4004 | 1770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25304 | | 4 | 1303 | abc40004 | 5004 | 2770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40304 | | 4 | 1303 | abc55004 | 6004 | 3770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55304 | | 4 | 1303 | abc70004 | 4 | 4770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70304 | | 4 | 1303 | abc85004 | 1004 | 5770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85304 | | 4 | 2303 | abc20004 | 6004 | 1437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20304 | | 4 | 2303 | abc35004 | 4 | 2437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35304 | | 4 | 2303 | abc50004 | 1004 | 3437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50304 | | 4 | 2303 | abc5004 | 5004 | 437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5304 | | 4 | 2303 | abc65004 | 2004 | 4437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65304 | | 4 | 2303 | abc80004 | 3004 | 5437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80304 | | 4 | 2303 | abc95004 | 4004 | 6437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95304 | +-----+------+----------+------+------+---------------------------------------+ 60 rows in set (0.02 sec) mysql> select * from t_orderby4 where id1 = 1 for update; +-----+-----+------+------+------+-------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+-----+------+------+------+-------------------------------------+ | 1 | 300 | abc1 | 1 | 101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh301 | +-----+-----+------+------+------+-------------------------------------+ 1 row in set (0.00 sec) mysql> select count(*) from t_orderby4 where id1 = 1 ; +----------+ | count(*) | +----------+ | 20 | +----------+ 1 row in set (0.00 sec) - 5.7.24 bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.24-debug MySQL Community Server - Debug (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `t_orderby4` ( -> `id1` int(11) NOT NULL, -> `id2` int(11) NOT NULL, -> `id3` varchar(64) COLLATE utf8_bin NOT NULL, -> `id4` int(11) DEFAULT NULL, -> `id5` int(11) DEFAULT NULL, -> `id6` varchar(64) COLLATE utf8_bin DEFAULT NULL, -> PRIMARY KEY (`id1`,`id2`,`id3`), -> KEY `id4` (`id4`,`id5`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; Query OK, 0 rows affected (0.01 sec) mysql> load data infile '/tmp/t_orderby4.csv' into table t_orderby4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 100000 rows affected (20.13 sec) Records: 100000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set session debug="d,compare_end_range"; Query OK, 0 rows affected (0.00 sec) mysql> select * from t_orderby4 where id1>1 and id1<5; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 2 | 301 | abc15002 | 1002 | 1102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15302 | | 2 | 301 | abc2 | 2 | 102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh302 | | 2 | 301 | abc30002 | 2002 | 2102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30302 | | 2 | 301 | abc45002 | 3002 | 3102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45302 | | 2 | 301 | abc60002 | 4002 | 4102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60302 | | 2 | 301 | abc75002 | 5002 | 5102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75302 | | 2 | 301 | abc90002 | 6002 | 6102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90302 | | 2 | 1301 | abc10002 | 3002 | 768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10302 | | 2 | 1301 | abc25002 | 4002 | 1768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25302 | | 2 | 1301 | abc40002 | 5002 | 2768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40302 | | 2 | 1301 | abc55002 | 6002 | 3768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55302 | | 2 | 1301 | abc70002 | 2 | 4768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70302 | | 2 | 1301 | abc85002 | 1002 | 5768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85302 | | 2 | 2301 | abc20002 | 6002 | 1435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20302 | | 2 | 2301 | abc35002 | 2 | 2435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35302 | | 2 | 2301 | abc50002 | 1002 | 3435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50302 | | 2 | 2301 | abc5002 | 5002 | 435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5302 | | 2 | 2301 | abc65002 | 2002 | 4435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65302 | | 2 | 2301 | abc80002 | 3002 | 5435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80302 | | 2 | 2301 | abc95002 | 4002 | 6435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95302 | | 3 | 302 | abc15003 | 1003 | 1103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15303 | | 3 | 302 | abc3 | 3 | 103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh303 | | 3 | 302 | abc30003 | 2003 | 2103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30303 | | 3 | 302 | abc45003 | 3003 | 3103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45303 | | 3 | 302 | abc60003 | 4003 | 4103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60303 | | 3 | 302 | abc75003 | 5003 | 5103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75303 | | 3 | 302 | abc90003 | 6003 | 6103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90303 | | 3 | 1302 | abc10003 | 3003 | 769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10303 | | 3 | 1302 | abc25003 | 4003 | 1769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25303 | | 3 | 1302 | abc40003 | 5003 | 2769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40303 | | 3 | 1302 | abc55003 | 6003 | 3769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55303 | | 3 | 1302 | abc70003 | 3 | 4769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70303 | | 3 | 1302 | abc85003 | 1003 | 5769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85303 | | 3 | 2302 | abc20003 | 6003 | 1436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20303 | | 3 | 2302 | abc35003 | 3 | 2436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35303 | | 3 | 2302 | abc50003 | 1003 | 3436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50303 | | 3 | 2302 | abc5003 | 5003 | 436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5303 | | 3 | 2302 | abc65003 | 2003 | 4436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65303 | | 3 | 2302 | abc80003 | 3003 | 5436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80303 | | 3 | 2302 | abc95003 | 4003 | 6436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95303 | | 4 | 303 | abc15004 | 1004 | 1104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15304 | | 4 | 303 | abc30004 | 2004 | 2104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30304 | | 4 | 303 | abc4 | 4 | 104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh304 | | 4 | 303 | abc45004 | 3004 | 3104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45304 | | 4 | 303 | abc60004 | 4004 | 4104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60304 | | 4 | 303 | abc75004 | 5004 | 5104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75304 | | 4 | 303 | abc90004 | 6004 | 6104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90304 | | 4 | 1303 | abc10004 | 3004 | 770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10304 | | 4 | 1303 | abc25004 | 4004 | 1770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25304 | | 4 | 1303 | abc40004 | 5004 | 2770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40304 | | 4 | 1303 | abc55004 | 6004 | 3770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55304 | | 4 | 1303 | abc70004 | 4 | 4770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70304 | | 4 | 1303 | abc85004 | 1004 | 5770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85304 | | 4 | 2303 | abc20004 | 6004 | 1437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20304 | | 4 | 2303 | abc35004 | 4 | 2437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35304 | | 4 | 2303 | abc50004 | 1004 | 3437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50304 | | 4 | 2303 | abc5004 | 5004 | 437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5304 | | 4 | 2303 | abc65004 | 2004 | 4437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65304 | | 4 | 2303 | abc80004 | 3004 | 5437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80304 | | 4 | 2303 | abc95004 | 4004 | 6437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95304 | +-----+------+----------+------+------+---------------------------------------+ 60 rows in set (0.01 sec) mysql> select * from t_orderby4 where id1 = 1 for update; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 1 | 300 | abc1 | 1 | 101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh301 | | 1 | 300 | abc15001 | 1001 | 1101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15301 | | 1 | 300 | abc30001 | 2001 | 2101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30301 | | 1 | 300 | abc45001 | 3001 | 3101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45301 | | 1 | 300 | abc60001 | 4001 | 4101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60301 | | 1 | 300 | abc75001 | 5001 | 5101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75301 | | 1 | 300 | abc90001 | 6001 | 6101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90301 | | 1 | 1300 | abc10001 | 3001 | 767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10301 | | 1 | 1300 | abc25001 | 4001 | 1767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25301 | | 1 | 1300 | abc40001 | 5001 | 2767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40301 | | 1 | 1300 | abc55001 | 6001 | 3767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55301 | | 1 | 1300 | abc70001 | 1 | 4767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70301 | | 1 | 1300 | abc85001 | 1001 | 5767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85301 | | 1 | 2300 | abc20001 | 6001 | 1434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20301 | | 1 | 2300 | abc35001 | 1 | 2434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35301 | | 1 | 2300 | abc50001 | 1001 | 3434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50301 | | 1 | 2300 | abc5001 | 5001 | 434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5301 | | 1 | 2300 | abc65001 | 2001 | 4434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65301 | | 1 | 2300 | abc80001 | 3001 | 5434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80301 | | 1 | 2300 | abc95001 | 4001 | 6434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95301 | +-----+------+----------+------+------+---------------------------------------+ 20 rows in set (0.00 sec) mysql> select count(*) from t_orderby4 where id1 = 1 ; +----------+ | count(*) | +----------+ | 20 | +----------+ 1 row in set (0.00 sec) - 5.7.26 rm -rf 95991 bin/mysqld-debug --initialize-insecure --basedir=$PWD --datadir=$PWD/95991 --log-error-verbosity=3 bin/mysqld-debug --no-defaults --basedir=$PWD --datadir=$PWD/95991 --core-file --socket=/tmp/mysql_ushastry.sock --port=3333 --log-error=$PWD/95991/log.err --log-error-verbosity=3 --secure-file-priv=/tmp/ 2>&1 & bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.26-debug MySQL Community Server - Debug (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `t_orderby4` ( -> `id1` int(11) NOT NULL, -> `id2` int(11) NOT NULL, -> `id3` varchar(64) COLLATE utf8_bin NOT NULL, -> `id4` int(11) DEFAULT NULL, -> `id5` int(11) DEFAULT NULL, -> `id6` varchar(64) COLLATE utf8_bin DEFAULT NULL, -> PRIMARY KEY (`id1`,`id2`,`id3`), -> KEY `id4` (`id4`,`id5`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin -> ; Query OK, 0 rows affected (0.01 sec) mysql> \q Bye [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.26: vi t_orderby4.sh [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.26: sh t_orderby4.sh [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.26: ls -lh t_orderby4.csv -rw-r--r-- 1 umshastr common 6.3M Jun 26 09:21 t_orderby4.csv [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.26: bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.26-debug MySQL Community Server - Debug (GPL) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> load data infile 't_orderby4.csv' into table t_orderby4 -> FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' -> LINES TERMINATED BY '\n'; ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement mysql> system cp t_orderby4.csv /tmp/ mysql> mysql> load data infile '/tmp/t_orderby4.csv' into table t_orderby4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 100000 rows affected (19.74 sec) Records: 100000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set session debug="d,compare_end_range"; Query OK, 0 rows affected (0.00 sec) mysql> select * from t_orderby4 where id1>1 and id1<5; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 2 | 301 | abc15002 | 1002 | 1102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15302 | | 2 | 301 | abc2 | 2 | 102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh302 | | 2 | 301 | abc30002 | 2002 | 2102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30302 | | 2 | 301 | abc45002 | 3002 | 3102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45302 | | 2 | 301 | abc60002 | 4002 | 4102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60302 | | 2 | 301 | abc75002 | 5002 | 5102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75302 | | 2 | 301 | abc90002 | 6002 | 6102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90302 | | 2 | 1301 | abc10002 | 3002 | 768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10302 | | 2 | 1301 | abc25002 | 4002 | 1768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25302 | | 2 | 1301 | abc40002 | 5002 | 2768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40302 | | 2 | 1301 | abc55002 | 6002 | 3768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55302 | | 2 | 1301 | abc70002 | 2 | 4768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70302 | | 2 | 1301 | abc85002 | 1002 | 5768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85302 | | 2 | 2301 | abc20002 | 6002 | 1435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20302 | | 2 | 2301 | abc35002 | 2 | 2435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35302 | | 2 | 2301 | abc50002 | 1002 | 3435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50302 | | 2 | 2301 | abc5002 | 5002 | 435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5302 | | 2 | 2301 | abc65002 | 2002 | 4435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65302 | | 2 | 2301 | abc80002 | 3002 | 5435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80302 | | 2 | 2301 | abc95002 | 4002 | 6435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95302 | | 3 | 302 | abc15003 | 1003 | 1103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15303 | | 3 | 302 | abc3 | 3 | 103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh303 | | 3 | 302 | abc30003 | 2003 | 2103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30303 | | 3 | 302 | abc45003 | 3003 | 3103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45303 | | 3 | 302 | abc60003 | 4003 | 4103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60303 | | 3 | 302 | abc75003 | 5003 | 5103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75303 | | 3 | 302 | abc90003 | 6003 | 6103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90303 | | 3 | 1302 | abc10003 | 3003 | 769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10303 | | 3 | 1302 | abc25003 | 4003 | 1769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25303 | | 3 | 1302 | abc40003 | 5003 | 2769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40303 | | 3 | 1302 | abc55003 | 6003 | 3769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55303 | | 3 | 1302 | abc70003 | 3 | 4769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70303 | | 3 | 1302 | abc85003 | 1003 | 5769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85303 | | 3 | 2302 | abc20003 | 6003 | 1436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20303 | | 3 | 2302 | abc35003 | 3 | 2436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35303 | | 3 | 2302 | abc50003 | 1003 | 3436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50303 | | 3 | 2302 | abc5003 | 5003 | 436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5303 | | 3 | 2302 | abc65003 | 2003 | 4436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65303 | | 3 | 2302 | abc80003 | 3003 | 5436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80303 | | 3 | 2302 | abc95003 | 4003 | 6436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95303 | | 4 | 303 | abc15004 | 1004 | 1104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15304 | | 4 | 303 | abc30004 | 2004 | 2104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30304 | | 4 | 303 | abc4 | 4 | 104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh304 | | 4 | 303 | abc45004 | 3004 | 3104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45304 | | 4 | 303 | abc60004 | 4004 | 4104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60304 | | 4 | 303 | abc75004 | 5004 | 5104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75304 | | 4 | 303 | abc90004 | 6004 | 6104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90304 | | 4 | 1303 | abc10004 | 3004 | 770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10304 | | 4 | 1303 | abc25004 | 4004 | 1770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25304 | | 4 | 1303 | abc40004 | 5004 | 2770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40304 | | 4 | 1303 | abc55004 | 6004 | 3770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55304 | | 4 | 1303 | abc70004 | 4 | 4770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70304 | | 4 | 1303 | abc85004 | 1004 | 5770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85304 | | 4 | 2303 | abc20004 | 6004 | 1437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20304 | | 4 | 2303 | abc35004 | 4 | 2437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35304 | | 4 | 2303 | abc50004 | 1004 | 3437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50304 | | 4 | 2303 | abc5004 | 5004 | 437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5304 | | 4 | 2303 | abc65004 | 2004 | 4437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65304 | | 4 | 2303 | abc80004 | 3004 | 5437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80304 | | 4 | 2303 | abc95004 | 4004 | 6437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95304 | +-----+------+----------+------+------+---------------------------------------+ 60 rows in set (0.02 sec) mysql> select * from t_orderby4 where id1 = 1 for update; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 1 | 300 | abc1 | 1 | 101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh301 | | 1 | 300 | abc15001 | 1001 | 1101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15301 | | 1 | 300 | abc30001 | 2001 | 2101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30301 | | 1 | 300 | abc45001 | 3001 | 3101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45301 | | 1 | 300 | abc60001 | 4001 | 4101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60301 | | 1 | 300 | abc75001 | 5001 | 5101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75301 | | 1 | 300 | abc90001 | 6001 | 6101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90301 | | 1 | 1300 | abc10001 | 3001 | 767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10301 | | 1 | 1300 | abc25001 | 4001 | 1767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25301 | | 1 | 1300 | abc40001 | 5001 | 2767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40301 | | 1 | 1300 | abc55001 | 6001 | 3767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55301 | | 1 | 1300 | abc70001 | 1 | 4767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70301 | | 1 | 1300 | abc85001 | 1001 | 5767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85301 | | 1 | 2300 | abc20001 | 6001 | 1434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20301 | | 1 | 2300 | abc35001 | 1 | 2434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35301 | | 1 | 2300 | abc50001 | 1001 | 3434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50301 | | 1 | 2300 | abc5001 | 5001 | 434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5301 | | 1 | 2300 | abc65001 | 2001 | 4434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65301 | | 1 | 2300 | abc80001 | 3001 | 5434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80301 | | 1 | 2300 | abc95001 | 4001 | 6434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95301 | +-----+------+----------+------+------+---------------------------------------+ 20 rows in set (0.00 sec) mysql> select count(*) from t_orderby4 where id1 = 1 ; +----------+ | count(*) | +----------+ | 20 | +----------+ 1 row in set (0.00 sec) - 8.0.16 rm -rf 95991/ bin/mysqld-debug --initialize-insecure --basedir=$PWD --datadir=$PWD/95991 --log-error-verbosity=3 bin/mysqld-debug --basedir=$PWD --datadir=$PWD/95991 --core-file --socket=/tmp/mysql_ushastry.sock --port=3333 --log-error=$PWD/95991/log.err --mysqlx-port=33330 --mysqlx-socket=/tmp/mysql_x_ushastry.sock --log-error-verbosity=3 --secure-file-priv=/tmp/ 2>&1 & bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 8.0.16-debug MySQL Community Server - GPL - Debug Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> use test Database changed mysql> CREATE TABLE `t_orderby4` ( -> `id1` int(11) NOT NULL, -> `id2` int(11) NOT NULL, -> `id3` varchar(64) COLLATE utf8_bin NOT NULL, -> `id4` int(11) DEFAULT NULL, -> `id5` int(11) DEFAULT NULL, -> `id6` varchar(64) COLLATE utf8_bin DEFAULT NULL, -> PRIMARY KEY (`id1`,`id2`,`id3`), -> KEY `id4` (`id4`,`id5`) -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin -> ; Query OK, 0 rows affected, 4 warnings (0.04 sec) mysql> load data infile '/tmp/t_orderby4.csv' into table t_orderby4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; Query OK, 100000 rows affected (24.63 sec) Records: 100000 Deleted: 0 Skipped: 0 Warnings: 0 mysql> set session debug="d,compare_end_range"; Query OK, 0 rows affected (0.00 sec) mysql> select * from t_orderby4 where id1>1 and id1<5; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 2 | 301 | abc15002 | 1002 | 1102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15302 | | 2 | 301 | abc2 | 2 | 102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh302 | | 2 | 301 | abc30002 | 2002 | 2102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30302 | | 2 | 301 | abc45002 | 3002 | 3102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45302 | | 2 | 301 | abc60002 | 4002 | 4102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60302 | | 2 | 301 | abc75002 | 5002 | 5102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75302 | | 2 | 301 | abc90002 | 6002 | 6102 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90302 | | 2 | 1301 | abc10002 | 3002 | 768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10302 | | 2 | 1301 | abc25002 | 4002 | 1768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25302 | | 2 | 1301 | abc40002 | 5002 | 2768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40302 | | 2 | 1301 | abc55002 | 6002 | 3768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55302 | | 2 | 1301 | abc70002 | 2 | 4768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70302 | | 2 | 1301 | abc85002 | 1002 | 5768 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85302 | | 2 | 2301 | abc20002 | 6002 | 1435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20302 | | 2 | 2301 | abc35002 | 2 | 2435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35302 | | 2 | 2301 | abc50002 | 1002 | 3435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50302 | | 2 | 2301 | abc5002 | 5002 | 435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5302 | | 2 | 2301 | abc65002 | 2002 | 4435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65302 | | 2 | 2301 | abc80002 | 3002 | 5435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80302 | | 2 | 2301 | abc95002 | 4002 | 6435 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95302 | | 3 | 302 | abc15003 | 1003 | 1103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15303 | | 3 | 302 | abc3 | 3 | 103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh303 | | 3 | 302 | abc30003 | 2003 | 2103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30303 | | 3 | 302 | abc45003 | 3003 | 3103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45303 | | 3 | 302 | abc60003 | 4003 | 4103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60303 | | 3 | 302 | abc75003 | 5003 | 5103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75303 | | 3 | 302 | abc90003 | 6003 | 6103 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90303 | | 3 | 1302 | abc10003 | 3003 | 769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10303 | | 3 | 1302 | abc25003 | 4003 | 1769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25303 | | 3 | 1302 | abc40003 | 5003 | 2769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40303 | | 3 | 1302 | abc55003 | 6003 | 3769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55303 | | 3 | 1302 | abc70003 | 3 | 4769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70303 | | 3 | 1302 | abc85003 | 1003 | 5769 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85303 | | 3 | 2302 | abc20003 | 6003 | 1436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20303 | | 3 | 2302 | abc35003 | 3 | 2436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35303 | | 3 | 2302 | abc50003 | 1003 | 3436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50303 | | 3 | 2302 | abc5003 | 5003 | 436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5303 | | 3 | 2302 | abc65003 | 2003 | 4436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65303 | | 3 | 2302 | abc80003 | 3003 | 5436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80303 | | 3 | 2302 | abc95003 | 4003 | 6436 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95303 | | 4 | 303 | abc15004 | 1004 | 1104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15304 | | 4 | 303 | abc30004 | 2004 | 2104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30304 | | 4 | 303 | abc4 | 4 | 104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh304 | | 4 | 303 | abc45004 | 3004 | 3104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45304 | | 4 | 303 | abc60004 | 4004 | 4104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60304 | | 4 | 303 | abc75004 | 5004 | 5104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75304 | | 4 | 303 | abc90004 | 6004 | 6104 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90304 | | 4 | 1303 | abc10004 | 3004 | 770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10304 | | 4 | 1303 | abc25004 | 4004 | 1770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25304 | | 4 | 1303 | abc40004 | 5004 | 2770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40304 | | 4 | 1303 | abc55004 | 6004 | 3770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55304 | | 4 | 1303 | abc70004 | 4 | 4770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70304 | | 4 | 1303 | abc85004 | 1004 | 5770 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85304 | | 4 | 2303 | abc20004 | 6004 | 1437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20304 | | 4 | 2303 | abc35004 | 4 | 2437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35304 | | 4 | 2303 | abc50004 | 1004 | 3437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50304 | | 4 | 2303 | abc5004 | 5004 | 437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5304 | | 4 | 2303 | abc65004 | 2004 | 4437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65304 | | 4 | 2303 | abc80004 | 3004 | 5437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80304 | | 4 | 2303 | abc95004 | 4004 | 6437 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95304 | +-----+------+----------+------+------+---------------------------------------+ 60 rows in set (0.00 sec) mysql> select * from t_orderby4 where id1 = 1 for update; +-----+------+----------+------+------+---------------------------------------+ | id1 | id2 | id3 | id4 | id5 | id6 | +-----+------+----------+------+------+---------------------------------------+ | 1 | 300 | abc1 | 1 | 101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh301 | | 1 | 300 | abc15001 | 1001 | 1101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh15301 | | 1 | 300 | abc30001 | 2001 | 2101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh30301 | | 1 | 300 | abc45001 | 3001 | 3101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh45301 | | 1 | 300 | abc60001 | 4001 | 4101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh60301 | | 1 | 300 | abc75001 | 5001 | 5101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh75301 | | 1 | 300 | abc90001 | 6001 | 6101 | xyzbhdfwejfwefgdhdskjghfsdddwfgh90301 | | 1 | 1300 | abc10001 | 3001 | 767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh10301 | | 1 | 1300 | abc25001 | 4001 | 1767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh25301 | | 1 | 1300 | abc40001 | 5001 | 2767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh40301 | | 1 | 1300 | abc55001 | 6001 | 3767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh55301 | | 1 | 1300 | abc70001 | 1 | 4767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh70301 | | 1 | 1300 | abc85001 | 1001 | 5767 | xyzbhdfwejfwefgdhdskjghfsdddwfgh85301 | | 1 | 2300 | abc20001 | 6001 | 1434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh20301 | | 1 | 2300 | abc35001 | 1 | 2434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh35301 | | 1 | 2300 | abc50001 | 1001 | 3434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh50301 | | 1 | 2300 | abc5001 | 5001 | 434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh5301 | | 1 | 2300 | abc65001 | 2001 | 4434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh65301 | | 1 | 2300 | abc80001 | 3001 | 5434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh80301 | | 1 | 2300 | abc95001 | 4001 | 6434 | xyzbhdfwejfwefgdhdskjghfsdddwfgh95301 | +-----+------+----------+------+------+---------------------------------------+ 20 rows in set (0.00 sec) mysql> select count(*) from t_orderby4 where id1 = 1 ; +----------+ | count(*) | +----------+ | 20 | +----------+ 1 row in set (0.00 sec)