您的位置:首页 > 数据库 > MySQL

ndb的sql语法跟mysql SQL语法不一直的地方

2011-11-23 15:42 232 查看
1,不支持临时表

在NDB存储引擎中,不支持临时表;不能创建临时表和改变已经存在的临时表的引擎为NDB;否则报“Table storage engine 'ndbcluster' does not
support the create option 'TEMPORARY'. ”。

2,索引和键的限制

(1),创建索引时,列宽不超过3072bytes;

(2),不可以在
TEXT
and
BLOB
列创建索引;

(3),不支持
FULLTEXT
索引,只有myisam支持;

(4),在唯一索引和主键索引中不使用NULL列;在重建索引时,不要使用hash选项。

(5),不可以在bit类型列上,创建主键,唯一索引,索引;也不可以在创建复合列上创建主键,唯一索引,索引;

(6),在创建表时,在表的主键上用
AUTO_INCREMENT
选项,不可以。

3, Geometry数据类型在NDB表中被支持,但是spatial索引不被支持。

4,当ndb_apply_status和ndb_binlog_index表中使用字符latin1(ASCii)设置,因为名字的二进制日志记录在表中,但是二进制文件名使用non-latin字符不能够被正确引用在表中。

解决这个问题,当命名二进制文件名,或者设置
--basedir
,
--log-bin
, or
--log-bin-index
选项使用latin-1字符。

5, [
LINEAR
]
KEY
自定义分区在mysql5.1中支持(包括MySQL Cluster NDB 6.X and 7.X through 7.1)被约束,从MySQL 5.1.12开始,任何分区类型在创建表式,使用
ENGINE=NDB
or
ENGINE=NDBCLUSTER
,结果中都会报错。

6,从MySQL 5.1.6,所有的mysql集群表的默认分区采用key,使用表主键作为分区键;如果表没有设置主键,“隐式”主键自动被NDBCLUSTER引擎创建。

从MySQL Cluster NDB 6.2.18, MySQL Cluster NDB 6.3.25, and MySQL Cluster NDB 7.0.6开始,create table和alter table语句,下面两种情况不允许,报错(Bug #40709):

(1),表必须有明确的主键。

(2),在分区表中所有的列表,必须是主键中的一部分。

7,在集群中使用基于行复制,二进制日志(binlog_format=row)不可以关闭,但是NDB存储引擎会忽略
参数"sql_log_bin"
(Bug #16680)。

8,在NDB CLUSTERZ中,只可以使用
KEY
和LINEAR KEY分区方式。


9,关于NDB分区

(1),当使用ndbd,在ndbcluster表中最大的分区数,

[
number_of_node_groups
] =
number_of_data_nodes
/
NoOfReplicas


NDB_MAX_PARTITION=8*
[
number of node groups
]
;

(2),当使用ndbmtd是,最大分区数计算取决于参数
MaxNoOfExecutionThreads
,NDB_MAX_PARTITION=4*
MaxNoOfExecutionThreads
*
[
number of node groups
]
;

//事务处理在NDB中的限制

1,事务隔离级别,NDB存储引擎只支持read committed级别。
InnoDB
支持的事务级别包括
READ COMMITTED
,
READ UNCOMMITTED
,
REPEATABLE READ
, and
SERIALIZABLE
.

2,Transactions and
BLOB
or
TEXT
columns.
NDBCLUSTER
stores only part of a column value that uses any of MySQL's
BLOB
or
TEXT
data types in the table visible to MySQL; the remainder of the
BLOB
or
TEXT
is stored in a separate internal table that is not accessible to MySQL. This gives rise to two related issues of which you should be aware whenever executing
SELECT
statements on tables that contain columns of these types:

For any
SELECT
from a MySQL Cluster table: If the
SELECT
includes a
BLOB
or
TEXT
column, the
READ COMMITTED
transaction isolation level is converted to a read with read lock. This is done to guarantee consistency.

Prior to MySQL Cluster NDB 7.0.12, for any
SELECT
which used a primary key lookup or unique key lookup to retrieve any columns that used any of the
BLOB
or
TEXT
data types and that was executed within a transaction, a shared read lock was held on the table for the duration of the transaction—that is, until the transaction was either committed or aborted.

3,事务回滚,回滚真个事务,不会回滚部分事务。

4,NDB引擎不适合处理单个很大的事务,适合处理小事务,包含尽可能少的语句操作。由于大事务需要大量内存。

(1),truncate table不是事务处理,如果truncate table失败,你需重新执行知道成功。

(2),delete from 是事务处理。

(3),load data infile不是事务处理。

//数据库对象在mysql集群中的限制

(1),单个分区可以容纳的数据行数的最大值为46137488。

(2),行大小,单行最大值为8052 bytes,Each
BLOB
or
TEXT
column contributes 256 + 8 = 264 bytes to this total.

//在NDB存储引擎上特殊的限制

1,sql_log_bin不影响数据操作,但是只 schema操作。

2,表中有blob列,且没有主键,不会产生二进制日志。

3,当不在mysqld上执行下列语句,下面的语句在schema操作,讲记录到集群二进制日志:

CREATE TABLE


ALTER TABLE


DROP TABLE


CREATE DATABASE
/
CREATE SCHEMA


DROP DATABASE
/
DROP SCHEMA


CREATE TABLESPACE


ALTER TABLESPACE


DROP TABLESPACE


CREATE LOGFILE GROUP


ALTER LOGFILE GROUP


DROP LOGFILE GROUP


//设计到mysql集群磁盘存储的限制

1,表空间创建的最大值: 232 (4294967296);

2,表空间包含的数据文件个数最大值:216 (65536) ;实际的上限为32G;

3,最大的数据文件大小:理论限制为64G(including MySQL Cluster NDB 6.X and 7.X through 7.1),相当于32765个extents(1M).表空间中区(extents)的最小值和最大值为32K和2G;

Disk Data tables and diskless mode. Use of Disk Data tables is not supported when running the cluster in diskless mode. Beginning with MySQL 5.1.12, it is prohibited altogether. (Bug #20008)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: