Вопрос

I have a MySQL MyISAM table which has 6.5G overhead. I'm in doubt whether I should optimize the table, or just create a new one, populate from the old one and rename it.

This is a production environment so downtime should be as little as possible. What's the best way to do this?

Это было полезно?

Решение

Creating a new table and transposing the data will mean that the original is still readable, however, if you're allowing writes to it, those writes will have to be transposed after the copy is complete. The optimize procedure is more reliable since it won't allow writes until the operation is complete, but as you note this does involve some down-time.

It really depends if there's enough write activity on this table to cause problems.

You should probably restore this database from a back-up on a test machine and try several different ways to perform this operation before committing to one on your production system.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top