Rechercher dans le manuel MySQL
22.1.7.1 Noncompliance with SQL Syntax in NDB Cluster
Some SQL statements relating to certain MySQL features produce
errors when used with NDB
tables,
as described in the following list:
Temporary tables. Temporary tables are not supported. Trying either to create a temporary table that uses the
NDB
storage engine or to alter an existing temporary table to useNDB
fails with the error Table storage engine 'ndbcluster' does not support the create option 'TEMPORARY'.Indexes and keys in NDB tables. Keys and indexes on NDB Cluster tables are subject to the following limitations:
Column width. Attempting to create an index on an
NDB
table column whose width is greater than 3072 bytes succeeds, but only the first 3072 bytes are actually used for the index. In such cases, a warning Specified key was too long; max key length is 3072 bytes is issued, and aSHOW CREATE TABLE
statement shows the length of the index as 3072.TEXT and BLOB columns. You cannot create indexes on
NDB
table columns that use any of theTEXT
orBLOB
data types.FULLTEXT indexes. The
NDB
storage engine does not supportFULLTEXT
indexes, which are possible forMyISAM
andInnoDB
tables only.However, you can create indexes on
VARCHAR
columns ofNDB
tables.USING HASH keys and NULL. Using nullable columns in unique keys and primary keys means that queries using these columns are handled as full table scans. To work around this issue, make the column
NOT NULL
, or re-create the index without theUSING HASH
option.Prefixes. There are no prefix indexes; only entire columns can be indexed. (The size of an
NDB
column index is always the same as the width of the column in bytes, up to and including 3072 bytes, as described earlier in this section. Also see Section 22.1.7.6, “Unsupported or Missing Features in NDB Cluster”, for additional information.)BIT columns. A
BIT
column cannot be a primary key, unique key, or index, nor can it be part of a composite primary key, unique key, or index.AUTO_INCREMENT columns. Like other MySQL storage engines, the
NDB
storage engine can handle a maximum of oneAUTO_INCREMENT
column per table. However, in the case of an NDB table with no explicit primary key, anAUTO_INCREMENT
column is automatically defined and used as a “hidden” primary key. For this reason, you cannot define a table that has an explicitAUTO_INCREMENT
column unless that column is also declared using thePRIMARY KEY
option. Attempting to create a table with anAUTO_INCREMENT
column that is not the table's primary key, and using theNDB
storage engine, fails with an error.
Restrictions on foreign keys. Support for foreign key constraints in NDB 8.0 is comparable to that provided by
InnoDB
, subject to the following restrictions:Every column referenced as a foreign key requires an explicit unique key, if it is not the table's primary key.
ON UPDATE CASCADE
is not supported when the reference is to the parent table's primary key.This is because an update of a primary key is implemented as a delete of the old row (containing the old primary key) plus an insert of the new row (with a new primary key). This is not visible to the
NDB
kernel, which views these two rows as being the same, and thus has no way of knowing that this update should be cascaded.SET DEFAULT
is not supported. (Also not supported byInnoDB
.)The
NO ACTION
keywords are accepted but treated asRESTRICT
. (Also the same as withInnoDB
.)In earlier versions of NDB Cluster, when creating a table with foreign key referencing an index in another table, it sometimes appeared possible to create the foreign key even if the order of the columns in the indexes did not match, due to the fact that an appropriate error was not always returned internally. A partial fix for this issue improved the error used internally to work in most cases; however, it remains possible for this situation to occur in the event that the parent index is a unique index. (Bug #18094360)
For more information, see Section 13.1.20.6, “Using FOREIGN KEY Constraints”, and Section 1.8.3.2, “FOREIGN KEY Constraints”.
NDB Cluster and geometry data types. Geometry data types (
WKT
andWKB
) are supported forNDB
tables. However, spatial indexes are not supported.Character sets and binary log files. Currently, the
ndb_apply_status
andndb_binlog_index
tables are created using thelatin1
(ASCII) character set. Because names of binary logs are recorded in this table, binary log files named using non-Latin characters are not referenced correctly in these tables. This is a known issue, which we are working to fix. (Bug #50226)To work around this problem, use only Latin-1 characters when naming binary log files or setting any the
--basedir
,--log-bin
, or--log-bin-index
options.Creating NDB tables with user-defined partitioning. Support for user-defined partitioning in NDB Cluster is restricted to [
LINEAR
]KEY
partitioning. Using any other partitioning type withENGINE=NDB
orENGINE=NDBCLUSTER
in aCREATE TABLE
statement results in an error.It is possible to override this restriction, but doing so is not supported for use in production settings. For details, see User-defined partitioning and the NDB storage engine (NDB Cluster).
Default partitioning scheme. All NDB Cluster tables are by default partitioned by
KEY
using the table's primary key as the partitioning key. If no primary key is explicitly set for the table, the “hidden” primary key automatically created by theNDB
storage engine is used instead. For additional discussion of these and related issues, see Section 23.2.5, “KEY Partitioning”.CREATE TABLE
andALTER TABLE
statements that would cause a user-partitionedNDBCLUSTER
table not to meet either or both of the following two requirements are not permitted, and fail with an error:The table must have an explicit primary key.
All columns listed in the table's partitioning expression must be part of the primary key.
Exception. If a user-partitioned
NDBCLUSTER
table is created using an empty column-list (that is, usingPARTITION BY [LINEAR] KEY()
), then no explicit primary key is required.Maximum number of partitions for NDBCLUSTER tables. The maximum number of partitions that can defined for a
NDBCLUSTER
table when employing user-defined partitioning is 8 per node group. (See Section 22.1.2, “NDB Cluster Nodes, Node Groups, Replicas, and Partitions”, for more information about NDB Cluster node groups.DROP PARTITION not supported. It is not possible to drop partitions from
NDB
tables usingALTER TABLE ... DROP PARTITION
. The other partitioning extensions toALTER TABLE
—ADD PARTITION
,REORGANIZE PARTITION
, andCOALESCE PARTITION
—are supported for NDB tables, but use copying and so are not optimized. See Section 23.3.1, “Management of RANGE and LIST Partitions” and Section 13.1.9, “ALTER TABLE Syntax”.Row-based replication. When using row-based replication with NDB Cluster, binary logging cannot be disabled. That is, the
NDB
storage engine ignores the value ofsql_log_bin
.JSON data type. The MySQL
JSON
data type is supported forNDB
tables in the mysqld supplied with NDB 8.0.An
NDB
table can have a maximum of 3JSON
columns.The NDB API has no special provision for working with
JSON
data, which it views simply asBLOB
data. Handling data asJSON
must be performed by the application.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-mysql-cluster-limitations-syntax.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.