Skip to content

Commit

Permalink
Historical-data-may-never-expire-master (#1855)
Browse files Browse the repository at this point in the history
* Historical-data-may-never-expire-master

* Update ttl-options.md

* Update ttl-options.md
  • Loading branch information
abby-cyber authored Jan 11, 2023
1 parent 2f1b711 commit 360b651
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 360b651

Please sign in to comment.