Mysql Alter table add column with ALGORITHM=INPLACE, LOCK=NONE

amazon-rdsawslockingMySQL

Am running below query

Query

Alter table dbname.tablename 
add column column1 varchar(50),
add column column2 text , 
ALGORITHM=INPLACE, LOCK=NONE;

It takes more time to execute.

Ideally running this without ALGORITHM=INPLACE, LOCK=NONE takes 30mins to execute.

Query am running for table size=24.4G and records-count=97lkahs.

Any suggestions on why does it take more time to execute?

Is there any way that i could achieve better on the same?

Version= 5.6.40
, Engine = Innodb
, Buffer pool size = 44.8 GB

Best Answer

Found out the issue. Ran out of storage space on RDS while running Alter table query.

For some reason it did not throw error disk space issue.

But when i tried without ALGORITHM=INPLACE like the query below, it throws out error of disk space issue.

Alter table dbname.tablename add column column1 varchar(50), add column column2 text , LOCK=NONE;

I increased 100G to see if that suffices the problem, it worked.

But i still did not understand the fact why does the alter query take 60mins to add two columns when i run the Alter statement above.

While Alter statement to add single column takes 30mins to complete.

How can we improvise the execution time for Alter statement, any suggestions would help?