Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Historical-data-may-never-expire-master #1855

Merged
merged 3 commits into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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