1

I have a MySQL Cluster database where the data is both in-memory and written to disk.

I'm trying to understand the ALTER ONLINE TABLE ... STORAGE MEMORY statement, so that I can use this technique to minimize DDL operations downtime.

The documentation does not clarify my doubts.

I have a table like this

CREATE TABLE `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=ndbcluster AUTO_INCREMENT=103 DEFAULT CHARSET=utf8

I'm adding a new field to the table with the ONLINE schema change

ALTER ONLINE TABLE `mytable` ADD `myfield` INT STORAGE MEMORY;

Query is successful, the new field exists and is correctly writable for all nodes.

If I ask the table schema to mysql

SHOW CREATE TABLE `mytable`;

mysql says

CREATE TABLE `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(255) NOT NULL,
`myfield` int(11) /*!50606 STORAGE MEMORY */ DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=ndbcluster AUTO_INCREMENT=103 DEFAULT CHARSET=utf8

So what I understand is that I have a table that is written to disk but has one field that is not. Am I right?

Is this field and its contents saved with the MySQL Cluster Backup system?

If the Cluster globally dies, I'm going to loose the field and its content?

Thanks!

  • My guess is that the data stored in this column are only in memory and never saved to disk. If the cluster dies, the data is gone (not the column, the column will be there, I guess with all the values NULL when the cluster gets alive again). As with any memory table. – ypercubeᵀᴹ Jan 7 '16 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.