Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

2.1.3.1 MySQL Database Object Names in the NDB API

This section discusses mapping of MySQL database objects to the NDB API.

Databases and Schemas.  Databases and schemas are not represented by objects as such in the NDB API. Instead, they are modelled as attributes of Table and Index objects. The value of the database attribute of one of these objects is always the same as the name of the MySQL database to which the table or index belongs. The value of the schema attribute of a Table or Index object is always 'def' (for default).

Tables.  MySQL table names are directly mapped to NDB table names without modification. Table names starting with 'NDB$' are reserved for internal use, as is the SYSTAB_0 table in the sys database.

Indexes.  There are two different type of NDB indexes:

  • Hash indexes are unique, but not ordered.

  • B-tree indexes are ordered, but permit duplicate values.

Names of unique indexes and primary keys are handled as follows:

  • For a MySQL UNIQUE index, both a B-tree and a hash index are created. The B-tree index uses the MySQL name for the index; the name for the hash index is generated by appending '$unique' to the index name.

  • For a MySQL primary key only a B-tree index is created. This index is given the name PRIMARY. There is no extra hash; however, the uniqueness of the primary key is guaranteed by making the MySQL key the internal primary key of the NDB table.

Column Names and Values.  NDB column names are the same as their MySQL names.