MySQL Forums
Forum List  »  MyISAM

Re: Repairing packed MyISAM tables with no index file (.MYI)
Posted by: Ingo Strüwing
Date: March 23, 2006 03:15AM

Well, yes and no.

If you want to have new indexes on the table, you need to unpack it first.

However, if you had indexes on the table before packing it, they are not automatically recreated when packing the table. After packing you have a .MYI file which contains just the header. SHOW INDEXES FROM table says that the indexes are disabled. That way you can store the table and even access it without having the indexes laying around. If you want to use the indexes later, you can then do "myisamchk -rq table.MYI" as myisampack suggests. This builds the indexes on the compressed table without unpacking it. You can get rid of the indexes again if you overwrite the .MYI file with the header-only version (which you need to copy before rebuilding the indexes). CAUTION: Be sure that the table cannot be opened by the server (mysqld) while you play with the files.

The code for the above is in principle in the server, I think. It should be possible to allow ALTER TABLE ENABLE KEYS and ALTER TABLE DISABLE KEYS even on compressed tables. If you want to have it, please file a feature request on bugs.mysql.com. However, I cannot give you much hope that it will be done in the forseeable future.

Regards

Ingo Strüwing, Senior Software Developer - Storage Engines
MySQL AB, www.mysql.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Repairing packed MyISAM tables with no index file (.MYI)
3534
March 23, 2006 03:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.