GBase 8a集群验证版本
GBase8a_MPP_Cluster-NoLicense-9.5.3.23.2-redhat7-x86_64.tar.bz2
集群拓扑结果
[gbase@localhost ~]$ gcadmin showdistribution vc vc1
Distribution ID: 1 | State: new | Total segment num: 2
Primary Segment Node IP Segment ID Duplicate Segment node IP
========================================================================================================================
| 192.168.255.3 | 1 | 192.168.255.2 |
------------------------------------------------------------------------------------------------------------------------
| 192.168.255.2 | 2 | 192.168.255.3 |
========================================================================================================================
自增列功能
简要介绍
GBase 8a集群自增列是指定 auto_increment 属性的列,自增列的列值单调递增(不保证连续)。自增列支持在以下数据类型的列上使用:tinyint、smallint、int、bigint。自增列可以唯一识别表中每一条记录,可方便用于查询、修改、删除等操作。
- 自增起始值:空表插入时,自增列的第一个值。
- 自增基值:自增列前一次插入的最大值。
- 自增步长:自增列数据入库时,下一行数据针对前一行数据的增量值。
集群自增列不允许指定自增列起始值,基值,步长参数,由集群自动维护。
自增列创建语法
自增列创建的语法如下:
create [temporary] table [if not exists] tbl_name (create_definition,...)
create_definition:
col_name column_definition
column_definition:
data_type [not null] [default default_value]
[auto_increment] [primary key]
创建自增列
创建自增列:
gbase> create table test_auto_increment(test_col int auto_increment primary key);
Query OK, 0 rows affected (Elapsed: 00:00:00.07)
gbase> show create table test_auto_increment;
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_auto_increment | CREATE TABLE "test_auto_increment" (
"test_col" int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY ("test_col")
) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)
- 非tinyint、smallint、int、bigint类型创建自增列报错:
gbase> create table test_auto_increment(test_col varchar(10) auto_increment);
ERROR 1063 (42000): Incorrect column specifier for column 'test_col'
gbase> create table test_auto_increment