更新时间:2024-06-29 GMT+08:00

KEY_BLOCK_SIZE

KEY_BLOCK_SIZE的选择与存储引擎有关。对于MyISAM表,KEY_BLOCK_SIZE可选地指定用于索引键块的字节大小。对于InnoDB表,KEY_BLOCK_SIZE指定用于压缩的InnoDB表的页面大小(以KB为单位)。GaussDB(DWS)不支持该属性,DSC迁移时会将属性删除。

输入示例

1
2
3
4
5
6
7
8
9
CREATE TABLE `public`.`runoob_tbl_test`(
    `runoob_id` VARCHAR(30),
    `runoob_title` VARCHAR(100) NOT NULL,
    `runoob_author` VARCHAR(40) NOT NULL,
    `submission_date` VARCHAR(30)
) ENGINE=MyISAM KEY_BLOCK_SIZE=8;

ALTER TABLE runoob_tbl_test ENGINE=InnoDB;
ALTER TABLE runoob_tbl_test KEY_BLOCK_SIZE=0;

输出示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
CREATE TABLE "public"."runoob_tbl_test"
(
  "runoob_id" VARCHAR(120),
  "runoob_title" VARCHAR(400) NOT NULL,
  "runoob_author" VARCHAR(160) NOT NULL,
  "submission_date" VARCHAR(120)
)
  WITH ( ORIENTATION = ROW, COMPRESSION = NO )
  NOCOMPRESS
  DISTRIBUTE BY HASH ("runoob_id");