r/mysql • • Mar 25 '25

question Adding columns fast

Hi All,

We are using Aurora mysql database.

There is a table having size ~500GB holding ~400million rows in it. We want to add a new column(varchar 20 , Nullable) to this table but its running long and getting timeout. So what is the possible options to get this done in fastest possible way?

I was expecting it to run fast by just making metadata change , but it seems its rewriting the whole table. I can think one option of creating a new table with the new column added and then back populate the data using "insert as select.." then rename the table and drop the old table. But this will take long time , so wanted to know , if any other quicker option exists?

5 Upvotes

18 comments sorted by

View all comments

Show parent comment

3

u/Informal_Pace9237 Mar 26 '25

Insert is slow. We are not doing it. We are doing Create table newtab AS Select ..... From oldtab;

It is fast if you have a fast disk.

To make it go faster increase you innodb_buffer_pool_size