diff --git a/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md b/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md index 9cebf80458c..5f33b7c3ab1 100644 --- a/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md +++ b/docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md @@ -16,8 +16,23 @@ This topic applies to native nGQL only. + If there are TTL options on a tag, an edge type, or a property, you can still add an index on them. +## TTL options + +The native nGQL TTL feature has the following options. + +|Option|Description| +|:---|:---| +|`ttl_col`|Specifies the property to set a timeout on. The data type of the property must be `int` or `timestamp`.| +|`ttl_duration`|Specifies the timeout adds-on value in seconds. The value must be a non-negative int64 number. A property expires if the sum of its value and the `ttl_duration` value is smaller than the current timestamp. If the `ttl_duration` value is `0`, the property never expires.| + + ## Data expiration and deletion +!!! caution + + - When the TTL options are set for a property of a tag or an edge type and the property's value is `NULL`, the property never expires. + - If a property with a default value of `now()` is added to a tag or an edge type and the TTL options are set for the property, the history data related to the tag or the edge type will never expire because the value of that property for the history data is the current timestamp. + ### Vertex property expiration Vertex property expiration has the following impact. @@ -40,20 +55,6 @@ NebulaGraph automatically deletes the expired data and reclaims the disk space d If TTL is [disabled](#remove_a_timeout), the corresponding data deleted after the last compaction can be queried again. -## TTL options - -The native nGQL TTL feature has the following options. - -|Option|Description| -|:---|:---| -|`ttl_col`|Specifies the property to set a timeout on. The data type of the property must be `int` or `timestamp`.| -|`ttl_duration`|Specifies the timeout adds-on value in seconds. The value must be a non-negative int64 number. A property expires if the sum of its value and the `ttl_duration` value is smaller than the current timestamp. If the `ttl_duration` value is `0`, the property never expires.| - - -!!! Note - - When the TTL options are set for a property and the property's value is `NULL`, the property never expires. - ## Use TTL options You must use the TTL options together to set a valid timeout on a property.