Bug #14787 dropping last index from table should be optimized
Submitted: 9 Nov 2005 15:08 Modified: 17 Dec 2010 7:45
Reporter: Elan Ruusamäe (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:5.0.15 OS:Any (PLD Linux)
Assigned to: CPU Architecture:Any

[9 Nov 2005 15:08] Elan Ruusamäe
Description:
if table has only one (last) index, then dropping that index should be imho just removing MYI file from filesystem for MyISAM tables.

mysql> alter table l drop index t;
Query OK, 4665853 rows affected (1 min 9.67 sec)
Records: 4665853  Duplicates: 0  Warnings: 0

according to the time it spent i think it rebuilt whole table indexes.

How to repeat:
use your imagination ;)
[15 Mar 2007 10:44] Ingo Strüwing
The header of the MYI file contains important information about the table layout. We cannot just drop that file.

Indeed in this version every ALTER TABLE makes a copy of the data file and rebuilds all indexes.

However, in 5.1 we began to do some optimizations. And we will continue to do so. Eventually your feature request will be implemented.
[17 Dec 2010 7:45] Susanne Ebrecht
I will close this bug report because there is already lots of work done on that topic.