I have a schema that uses InnoDB table type and foreign keys.
I am planning to use mysql Cluster and I just want to make sure that I can use “InnoDB” table type and foreign key constraints will be still valid.
Update:
As per the documentation:
It is possible to create tables using
other storage engines (such as MyISAM
or InnoDB) on a MySQL server being
used with a MySQL Cluster, but these
non-NDB tables do not participate in
clustering; each such table is
strictly local to the individual MySQL
server instance on which it is
created.
Does it mean that if I create an InnoDB table, I can have foreign key constraint? I understand those tables will not participate in clustering.
No, they all use
NDBCLUSTERas a storage engine, and foreign key constraints are not available before 5.6/ MySQL Cluster NDB 7.3. Starting with MySQL Cluster NDB 7.3 foreign keys are possible.Tables that do not participate in clustering can be InnoDB (or any other ), but are local to the server only (i.e. the other servers are not aware of that table), so the table can only be queried on one of the nodes (which kind of defeats the advantages of clustering).
All features of the engine are then of course available, so indeed, the InnoDB table can have foreign key constraints, but the same rules apply with InnoDB<>NDB as InnoDB<>MyISAM: MySQL won’t complain if you mention a column located in an NDB/MyISAM table in an InnoDB table definition, but won’t enforce the integrity either.