Get the App
SLTechnology News&Howtos  ›  Database  › 

Can the index be deleted in mysql?

Shulou Source: shulou.com Published: 2022-06-01 02:40:26 09月16日 Update

This article mainly introduces whether the index in mysql can be deleted, the article is very detailed, has a certain reference value, interested friends must read it!

The index in mysql can be deleted, and the index can be deleted using the "DROP INDEX" statement in the syntax format "DROP INDEX ON". Unused indexes are recommended for deletion because they slow down the update speed of the table and affect the performance of the database.

To delete an index is to delete an index that already exists in the table. Unused indexes are recommended for deletion because they slow down the update speed of the table and affect the performance of the database. For such an index, it should be deleted.

Basic grammar

When the index is no longer needed, you can use the DROP INDEX statement to delete the index.

Syntax format:

DROP INDEX ON

The syntax is as follows:

The name of the index to delete

Specifies the name of the table in which the index is located

Example:

Delete the index in the table tb_stu_info, and enter the SQL statement and the execution result as shown below.

Mysql > DROP INDEX height-> ON tb_stu_info Query OK, 0 rows affected (0.27 sec) Records: 0 Duplicates: 0 Warnings: 0mysql > SHOW CREATE TABLE tb_stu_info\ Graph * 1. Row * * Table: tb_stu_infoCreate Table: CREATE TABLE `tb_stu_ info` (`id`int (11) NOT NULL, `name` char (45) DEFAULT NULL `dept_ id` int (11) DEFAULT NULL, `age` int (11) DEFAULT NULL, `height` int (11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=gb23121 row in set (above 0.00 sec are all the contents that can be deleted by the index in mysql Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Index grammar statement no content suggestion performance data database format speed influence update value interest partner place more knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Huawei Apple MySQL Redmi