文档

DDL异步执行语法扩展

更新时间:

本文介绍PolarDB-X 2.0的DDL异步执行语法扩展。

背景

之前PolarDB-X 2.0的DDL异步执行只能通过HINT控制,例如:/*+TDDL:cmd_extra(PURE_ASYNC_DDL_MODE = true)*/,这种方式存在两个明显的问题:

  • HINT的格式和内容比较复杂,不易理解和使用。

  • 使用命令行方式时,需要-c参数HINT才会生效,容易在编写命令时遗漏。

为了解决以上问题,PolarDB-X 2.0扩展了部分DDL的语法,新增ASYNC=TRUE选项来支持异步执行。

说明

DDL中同时使用ASYNCHINT的情况下,以ASYNC的为准。

支持版本

PolarDB-X 2.0的计算节点的版本为5.4.18-17142802及以上。

支持的DDL类型

运维DDL

continue ddl #job async=true;
cancel ddl #job async=true;
rollback ddl #job async=true;
pause ddl #job async=true;
pause rebalance #job async=true;
continue rebalance #job async=true;
cancel rebalance #job async=true;

OPTIMIZE TABLE

optimize table #tb async=true;

ANALYZE TABLE

analyze table #tb async=true;

ALTER TABLE

alter table #tb add index #index(a) async=true;
alter table #tb add global index #gsi(a) partition by key(a) partition async=true;
alter table #tb modify column a bigint async=true;
alter table #tb drop column a async=true;
alter table #tb drop index #index async=true;
alter table #tb split partition p1 aysnc=true;
alter table #tb move partition p1 to #dn aysnc=true;
alter table #tb set tablegroup=#tg aysnc=true;
...
说明

支持所有ALTER TABLE语句。

ALTER TABLEGROUP

alter tablegroup #tg move partitions #p,#p to #dn aysnc=true;
alter tablegroup #tg split partition #p aysnc=true;
说明

支持所有ALTER TABLEGROUP语句。

CREATE GLOBAL INDEX

create globle index on #tb(#col) partition_definition async=true;

CREATE INDEX

create index on #tb(#col) async=true;

不支持的DDL类型

  • CREATE TABLE

  • DROP TABLE

  • CREATE VIEW

  • DROP VIEW

  • CREATE PROCEDURE

  • DROP PROCEDURE

  • CREATE DATABASE

  • DROP DATABASE

  • CREATE TABLEGROUP

  • DROP TABLEGROUP

  • CREATE SEQUENCE

  • DROP SEQUENCE

  • ALTER SEQUENCE