We got MySQL database on AWS RDS with innodb engine, the MySQL version is 5.6.19.
When trying to add a column in a table, we get the error message below:
ERROR 1041 (HY000): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
The script we run to alter table is below:
ALTER TABLE mytablename
ADD COLUMN temp_colume varchar(255) NULL AFTER temp_firstcolumn;
Our RDS is on db.m3.2xlarge with 30GB memory: Our innodb buffer size is DBInstanceClassMemory*3/4 ~= 24GB
We can successfully re-creating the table with the column changes already made to it, but we are getting error when altering tables.
Does anyone meet the same issue?
If your freeable memory remains consistently low, you can change your RDS DB instance size to a larger instance size that has more memory. To monitor swap memory, turn on Enhanced Monitoring to review metrics in intervals with a granularity of as little as one second.
An Amazon RDS DB instance in the storage-full status doesn't have enough available space to perform basic operations, such as connecting to or restarting the instance. To resolve this issue, do the following: Confirm that the DB instance status is storage-full. Increase the allocated storage of your DB instance.
I've seen inplace alters in RDS fail lately. AWS support recommended modifying the alter table statement to look like this:
ALTER TABLE tbl ADD COLUMN abc varchar(123) AFTER zyx, ALGORITHM=COPY
The secret is to add
, ALGORITHM=COPY
to the end as a work around.
You could also failover the RDS instance https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With