Reputation: 43
I have an sales table with millions of records and I want to extend it with a new field. I know ALTER TABLE would certainly lead never ending process. Is there a faster way to do this?
Upvotes: 2
Views: 1450
Reputation: 3008
Create table TEMP_TABLE WITH similer to your old table with additional column
INSERT INTO TAMP_TABLE (SELECT * FROM TABLE);
DROP TABLE OLD_TABLE;
RENAME TABLE TEMP_TABLE TO OLD_TABLE_NAME;
Upvotes: 2