Skip to content

Commit

Permalink
optimize schema limits (#2360)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Chen <[email protected]>
  • Loading branch information
cooper-lzy and ChrisChen2023 authored Nov 17, 2023
1 parent 684c9f4 commit d0ca65f
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs-2.0-en/3.ngql-guide/10.tag-statements/1.create-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TAG [IF NOT EXISTS] <tag_name>
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the tag that you want to create exists. If it does not exist, a new one will be created. The tag existence detection here only compares the tag names (excluding properties).|
|`<tag_name>`|1. Each tag name in the graph space must be **unique**. <br>2. Tag names cannot be modified after they are set.<br>3. Tag names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not support special characters other than underscores. To use special characters, reserved keywords, or start with a number in a tag name, enclose them in backticks (\`), and do not use periods (`.`) in a tag name. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a tag in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<tag_name>`|1. Each tag name in the graph space must be **unique**. <br>2. Tag names cannot be modified after they are set.<br/> 3. By default, the space name only supports 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc. However, it cannot include special characters other than the underscore (_), and cannot start with a number.<br/> 4. To use special characters, reserved keywords, or start with a number, quote the entire name with backticks (\`) and do not include periods (`.`) with the pair of backticks (\`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a tag in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<prop_name>`|The name of the property. It must be unique for each tag. The rules for permitted property names are the same as those for tag names.|
|`<data_type>`|Shows the data type of each property. For a full description of the property data types, see [Data types](../3.data-types/1.numeric.md) and [Boolean](../3.data-types/2.boolean.md).|
|`NULL \| NOT NULL`|Specifies if the property supports `NULL | NOT NULL`. The default value is `NULL`. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE EDGE [IF NOT EXISTS] <edge_type_name>
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the edge type that you want to create exists. If it does not exist, a new one will be created. The edge type existence detection here only compares the edge type names (excluding properties).|
|`<edge_type_name>`|1. The edge type name must be **unique** in a graph space.<br/> 2. Once the edge type name is set, it can not be altered.<br/> 3. Edge type names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not include special characters other than underscores. To use special characters, reserved keywords or starting with a number, quote them with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). <br/>**Note**: If you name an edge type in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<edge_type_name>`|1. The edge type name must be **unique** in a graph space.<br/> 2. Once the edge type name is set, it can not be altered.<br/> 3. By default, the space name only supports 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc. But special characters can only use underscore, and cannot start with a number.<br/> 4. To use special characters, reserved keywords, or start with a number, quote the entire name with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). <br/>**Note**: If you name an edge type in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<prop_name>`|The name of the property. It must be unique for each edge type. The rules for permitted property names are the same as those for edge type names.|
|`<data_type>`|Shows the data type of each property. For a full description of the property data types, see [Data types](../3.data-types/1.numeric.md) and [Boolean](../3.data-types/2.boolean.md).|
|`NULL \| NOT NULL`|Specifies if the property supports `NULL | NOT NULL`. The default value is `NULL`. `DEFAULT` must be specified if `NOT NULL` is set.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name> ON {<tag_name> | <edge_na
|:---|:---|
|`TAG | EDGE`|Specifies the index type that you want to create.|
|`IF NOT EXISTS`|Detects if the index that you want to create exists. If it does not exist, a new one will be created.|
|`<index_name>`|The name of the index. It must be unique in a graph space. A recommended way of naming is `i_tagName_propName`. <br/>Index names cannot start with a number. They supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), numbers, and Chinese characters, but does not support special characters except underscores. To use special characters, reserved keywords, or starting with a number, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).<br/>**Note**: If you name an index in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`). |
|`<index_name>`|The name of the index. It must be unique in a graph space. A recommended way of naming is `i_tagName_propName`. <br/> By default, the space name only supports 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc. But special characters can only use underscore, and cannot start with a number.<br/> To use special characters, reserved keywords, or start with a number, quote the entire name with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).<br/>**Note**: If you name an index in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`). |
|`<tag_name> | <edge_name>`|Specifies the name of the tag or edge associated with the index.|
|`<prop_name_list>`|To index a **variable-length** string property, you must use `prop_name(length)` to specify the index length, and the maximum index length is 256. To index a tag or an edge type, ignore the `prop_name_list`.|
|`COMMENT`|The remarks of the index. The maximum length is 256 bytes. By default, there will be no comments on an index.|
Expand Down
4 changes: 2 additions & 2 deletions docs-2.0-en/3.ngql-guide/9.space-statements/1.create-space.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the related graph space exists. If it does not exist, a new one will be created. The graph space existence detection here only compares the graph space name (excluding properties).|
|`<graph_space_name>`|1. Uniquely identifies a graph space in a NebulaGraph instance. <br/>2. Space names cannot be modified after they are set.<br/> 3. Space names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not include special characters other than underscores. To use special characters, reserved keywords or starting with a number, quote them with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a space in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<graph_space_name>`|1. Uniquely identifies a graph space in a NebulaGraph instance. <br/>2. Space names cannot be modified after they are set.<br/> 3. By default, the space name only supports 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc. But special characters can only use underscore, and cannot start with a number.<br/> 4. To use special characters, reserved keywords, or start with a number, quote the entire name with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a space in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`partition_num`|Specifies the number of partitions in each replica. The suggested value is 20 times (2 times for HDD) the number of the hard disks in the cluster. For example, if you have three hard disks in the cluster, we recommend that you set 60 partitions. The default value is 100.|
|`replica_factor`|Specifies the number of replicas in the cluster. The suggested number is 3 in a production environment and 1 in a test environment. The replica number must be an **odd number** for the need of quorum-based voting. The default value is 1.|
|`vid_type`|A required parameter. Specifies the VID type in a graph space. Available values are `FIXED_STRING(N)` and `INT64`. `INT` equals to `INT64`. <br>``FIXED_STRING(<N>)` specifies the VID as a string, while `INT64` specifies it as an integer. `N` represents the maximum length of the VIDs. If you set a VID that is longer than `N` bytes, NebulaGraph throws an error. Note, for UTF-8 chars, the length may vary in different cases, i.e. a UTF-8 Chinese char is 3 byte, this means 11 Chinese chars(length-33) will exeed a FIXED_STRING(32) vid defination.|
Expand Down Expand Up @@ -64,7 +64,7 @@ CREATE SPACE [IF NOT EXISTS] <new_graph_space_name> AS <old_graph_space_name>;
| Parameter | Description |
| :--- | :--- |
|`IF NOT EXISTS`|Detects if the new graph space exists. If it does not exist, the new one will be created. The graph space existence detection here only compares the graph space name (excluding properties).|
| `<new_graph_space_name>` | The name of the graph space that is newly created. The name of the graph space starts with a letter, supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), digits, and Chinese characters, but does not support special characters except underscores. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). When a new graph space is created, the schema of the old graph space `<old_graph_space_name>` will be cloned, including its parameters (the number of partitions and replicas, etc.), Tag, Edge type and native indexes. |
| `<new_graph_space_name>` | The name of the graph space that is newly created. <br/> By default, the space name only supports 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc. But special characters can only use underscore, and cannot start with a number.<br/> To use special characters, reserved keywords, or start with a number, quote the entire name with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). <br/>When a new graph space is created, the schema of the old graph space `<old_graph_space_name>` will be cloned, including its parameters (the number of partitions and replicas, etc.), Tag, Edge type and native indexes.<br/> **Note**: If you name a space in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
| `<old_graph_space_name>` | The name of the graph space that already exists. |

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0-zh/3.ngql-guide/10.tag-statements/1.create-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TAG [IF NOT EXISTS] <tag_name>
|参数|说明|
|:---|:---|
|`IF NOT EXISTS`|检测待创建的 Tag 是否存在,只有不存在时,才会创建 Tag。仅检测 Tag 的名称,不会检测具体属性。|
|`<tag_name>`|1、每个图空间内的 Tag 必须是唯一的。<br>2、Tag 名称设置后无法修改。<br>3、不能以数字开头;支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是不包括除下划线外的特殊字符;使用特殊字符、保留关键字或数字开头时,需要用反引号\`包围且不能使用英文句号`.`)。详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文命名 Tag,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<tag_name>`|1、每个图空间内的 Tag 必须是唯一的。<br>2、Tag 名称设置后无法修改。<br>3、默认情况下,仅支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是特殊字符只能使用下划线。不能以数字开头。<br>4、如果需要使用特殊字符、保留关键字或者以数字开头,请使用反引号\`包围整个名称。反引号中不能包含英文句号`.`)。详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文命名 Tag,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<prop_name>`|属性名称。每个 Tag 中的属性名称必须唯一。属性的命名规则与 Tag 相同。|
|`<data_type>`|属性的数据类型,目前支持[数值](../3.data-types/1.numeric.md)[布尔](../3.data-types/2.boolean.md)[字符串](../3.data-types/3.string.md)以及[日期与时间](../3.data-types/4.date-and-time.md)|
|`NULL \| NOT NULL`|指定属性值是否支持为`NULL`。默认值为`NULL`。指定`NOT NULL`且没有指定`DEFAULT`值时,插入数据必须指定值;同时指定`NOT NULL``DEFAULT`值时,插入数据如果没有指定值,则默认插入`DEFAULT`值。|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE EDGE [IF NOT EXISTS] <edge_type_name>
|参数|说明|
|:---|:---|
|`IF NOT EXISTS`|检测待创建的 Edge type 是否存在,只有不存在时,才会创建 Edge type。仅检测 Edge type 的名称,不会检测具体属性。|
|`<edge_type_name>`|1、每个图空间内的 Edge type 必须是唯一的。<br/> 2、Edge type 名称设置后无法修改。<br/>3、不能以数字开头;支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是不包括除下划线外的特殊字符;使用特殊字符、保留关键字或数字开头时,需要用反引号\`包围且不能使用英文句号`.`)。详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文命名 Edge type,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<edge_type_name>`|1、每个图空间内的 Edge type 必须是唯一的。<br/> 2、Edge type 名称设置后无法修改。<br/>3、默认情况下,仅支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是特殊字符只能使用下划线。不能以数字开头。<br>4、如果需要使用特殊字符、保留关键字或者以数字开头,请使用反引号\`包围整个名称。反引号中不能包含英文句号`.`)。详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文命名 Edge type,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<prop_name>`|属性名称。每个 Edge type 中的属性名称必须唯一。属性的命名规则与 Edge type 相同。|
|`<data_type>`|属性的数据类型,目前支持[数值](../3.data-types/1.numeric.md)[布尔](../3.data-types/2.boolean.md)[字符串](../3.data-types/3.string.md)以及[日期与时间](../3.data-types/4.date-and-time.md)|
|`NULL \| NOT NULL`|指定属性值是否支持为`NULL`。默认值为`NULL`。当指定属性值为`NOT NULL`时,必需指定属性的默认值,也就是`DEFAULT`的值。|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name> ON {<tag_name> | <edge_na
|:---|:---|
|`TAG | EDGE`| 指定要创建的索引类型。|
|`IF NOT EXISTS`|检测待创建的索引是否存在,只有不存在时,才会创建索引。|
|`<index_name>`|索引名。索引名在一个图空间中必须是唯一的。推荐的命名方式为`i_tagName_propName`。<br/>索引名称不能以数字开头,支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是不包括除下划线外的特殊字符。使用特殊字符、保留关键字或数字开头时,需要用反引号\`包围,详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文为索引命名,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<index_name>`|索引名。索引名在一个图空间中必须是唯一的。推荐的命名方式为`i_tagName_propName`。<br/>默认情况下,仅支持 1~4 字节的 UTF-8 编码字符,包括英文字母(区分大小写)、数字、中文等,但是特殊字符只能使用下划线。不能以数字开头。<br>如果需要使用特殊字符、保留关键字或者以数字开头,请使用反引号\`包围整个名称。反引号中不能包含英文句号(`.`)。详情参见[关键字和保留字](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md)。<br/>**注意**:如果以中文为索引命名,报`SyntaxError`错误时,需使用反引号(\`)包围中文字符。|
|`<tag_name> | <edge_name>`|指定索引关联的 Tag 或 Edge 名称。|
|`<prop_name_list>`|**变长**字符串属性创建索引时,必须用`prop_name(length)`指定索引长度,索引长度最长为 256;为 Tag 或 Edge type 本身创建索引时,忽略`<prop_name_list>`|
|`COMMENT`|索引的描述。最大为 256 字节。默认无描述。|
Expand Down
Loading

0 comments on commit d0ca65f

Please sign in to comment.