List:General Discussion« Previous MessageNext Message »
From:Jake Peavy Date:June 17 2005 8:18pm
Subject:Re: alter only an enum label
View as plain text  
On 6/16/05, Gabriel B. <gabriel.barros@stripped> wrote:
> If i have a table with about 800M records. and one of the fields is a
> enum("a", "b", "c") and i want to change it to enum("a","b","x") 

My understanding (such as it is) is that the best way to do this is to add a 
second column with enum('a','b','x') and set the value using the integer 
value of the first column as follows. (adding 0 casts enum as integer)

ALTER TABLE table ADD new_column enum('a','b','x');
UPDATE table SET new_column = old_column + 0;
ALTER TABLE table DROP old_column;

Execution time is dependent on the speed of the update, but it would need to 
read every row.

Thread
alter only an enum labelGabriel B.16 Jun
  • Re: alter only an enum labelJake Peavy17 Jun
RE: alter only an enum labelGordon Bruce16 Jun
  • Re: alter only an enum labelGabriel B.16 Jun
RE: alter only an enum labelGordon Bruce16 Jun