CREATE SHARDING KEY GENERATOR

Description

The CREATE SHARDING KEY GENERATOR syntax is used to add a distributed primary key generator for the currently selected logic database

Syntax

  1. CreateShardingAlgorithm ::=
  2. 'CREATE' 'SHARDING' 'KEY' 'GENERATOR' keyGeneratorName '(' algorithmDefinition ')'
  3. algorithmDefinition ::=
  4. 'TYPE' '(' 'NAME' '=' algorithmType ( ',' 'PROPERTIES' '(' propertyDefinition ')' )?')'
  5. propertyDefinition ::=
  6. ( key '=' value ) ( ',' key '=' value )*
  7. keyGeneratorName ::=
  8. identifier
  9. algorithmType ::=
  10. string

Supplement

  • algorithmType is the key generate algorithm type. For detailed key generate algorithm type information, please refer to KEY GENERATE ALGORITHM.

Example

Create a distributed primary key generator

  1. CREATE SHARDING KEY GENERATOR snowflake_key_generator (
  2. TYPE(NAME="SNOWFLAKE", PROPERTIES("max-vibration-offset"="3"))
  3. );

Reserved word

CREATE, SHARDING, KEY, GENERATOR, TYPE, NAME, PROPERTIES