MariaDB [(none)]> create database test2;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> use test2;
Database changed
MariaDB [test2]> create table t1 (
    ->   kp1 int,
    ->   kp2 int,
    ->   kp3 int,
    ->   col1 int, 
    ->   col2 int,
    ->   key(kp1,kp2,kp3)
    -> );
Query OK, 0 rows affected (0.018 sec)

MariaDB [test2]> 
MariaDB [test2]> insert into t1 select 
    ->   seq/10000,
    ->   seq,
    ->   seq,
    ->   seq, seq
    -> from 
    ->   seq_1_to_100000;
Query OK, 100000 rows affected (9.067 sec)
Records: 100000  Duplicates: 0  Warnings: 0

MariaDB [test2]> 
MariaDB [test2]> explain select * from t1 where kp1=1 and (kp2=1 or kp3=1);
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows  | Extra       |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
|    1 | SIMPLE      | t1    | ALL  | kp1           | NULL | NULL    | NULL | 99900 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
1 row in set (0.003 sec)

MariaDB [test2]> explain select * from t1 where kp1=1 and (kp2=1);
+------+-------------+-------+------+---------------+------+---------+-------------+------+-------+
| id   | select_type | table | type | possible_keys | key  | key_len | ref         | rows | Extra |
+------+-------------+-------+------+---------------+------+---------+-------------+------+-------+
|    1 | SIMPLE      | t1    | ref  | kp1           | kp1  | 10      | const,const | 1    |       |
+------+-------------+-------+------+---------------+------+---------+-------------+------+-------+
1 row in set (0.000 sec)

MariaDB [test2]> alter table t1 add key(kp2), add key(kp3);
Query OK, 0 rows affected (1.737 sec)               
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [test2]> explain select * from t1 where kp1=1 and (kp2=1 or kp3=1);
+------+-------------+-------+-------------+---------------+---------+---------+------+------+-----------------------------------+
| id   | select_type | table | type        | possible_keys | key     | key_len | ref  | rows | Extra                             |
+------+-------------+-------+-------------+---------------+---------+---------+------+------+-----------------------------------+
|    1 | SIMPLE      | t1    | index_merge | kp1,kp2,kp3   | kp2,kp3 | 5,5     | NULL | 2    | Using union(kp2,kp3); Using where |
+------+-------------+-------+-------------+---------------+---------+---------+------+------+-----------------------------------+
1 row in set (0.005 sec)

MariaDB [test2]> alter table t1 drop key kp2;
Query OK, 0 rows affected (0.009 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [test2]> alter table t1 drop key kp3;
Query OK, 0 rows affected (0.011 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [test2]> explain select * from t1 where kp1=1 and (kp2=1 or kp3=1);
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows  | Extra       |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
|    1 | SIMPLE      | t1    | ALL  | kp1           | NULL | NULL    | NULL | 99900 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+-------+-------------+
1 row in set (0.005 sec)

MariaDB [test2]> show create table t1]
    -> \c
MariaDB [test2]> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `kp1` int(11) DEFAULT NULL,
  `kp2` int(11) DEFAULT NULL,
  `kp3` int(11) DEFAULT NULL,
  `col1` int(11) DEFAULT NULL,
  `col2` int(11) DEFAULT NULL,
  KEY `kp1` (`kp1`,`kp2`,`kp3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.001 sec)

MariaDB [test2]> alter table t1 add key(kp1, kp3);
Query OK, 0 rows affected (1.099 sec)               
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [test2]> explain select * from t1 where kp1=1 and (kp2=1 or kp3=1);
+------+-------------+-------+-------------+---------------+-----------+---------+------+------+------------------------------------------+
| id   | select_type | table | type        | possible_keys | key       | key_len | ref  | rows | Extra                                    |
+------+-------------+-------+-------------+---------------+-----------+---------+------+------+------------------------------------------+
|    1 | SIMPLE      | t1    | index_merge | kp1,kp1_2     | kp1,kp1_2 | 10,10   | NULL | 2    | Using sort_union(kp1,kp1_2); Using where |
+------+-------------+-------+-------------+---------------+-----------+---------+------+------+------------------------------------------+
1 row in set (0.006 sec)

MariaDB [test2]> 
