O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

If you wish to drop the index on last_name, rather than directly dropping, you can mark it as invisible using the ALTER TABLE command:

mysql> EXPLAIN SELECT * FROM employees WHERE last_name='Aamodt'\G*************************** 1. row ***************************           id: 1  select_type: SIMPLE        table: employees   partitions: NULL         type: refpossible_keys: last_name          key: last_name      key_len: 66          ref: const         rows: 205     filtered: 100.00        Extra: NULL1 row in set, 1 warning (0.00 sec)mysql> ALTER TABLE employees ALTER INDEX last_name INVISIBLE;Query OK, 0 rows affected (0.01 sec)Records: 0  Duplicates: 0  Warnings: 0mysql> EXPLAIN SELECT * FROM employees WHERE last_name='Aamodt'\G*************************** 1. row *************************** id: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required