From 5335bfd3c706ddf2fae77dbf63ed18db30e46b2e Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Fri, 6 Jan 2023 17:17:04 +0800 Subject: [PATCH 1/3] Historical-data-may-never-expire-master --- docs-2.0/3.ngql-guide/8.clauses-and-options/ttl-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..255c3ecd482 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 @@ -52,7 +52,7 @@ The native nGQL TTL feature has the following options. !!! Note - When the TTL options are set for a property and the property's value is `NULL`, the property never expires. + When the TTL options are set for a property and the property's value is `NULL` or `now()`, the property never expires. ## Use TTL options From eb87285dee287c345c1783154d87a2d0689fbd57 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:32:40 +0800 Subject: [PATCH 2/3] Update ttl-options.md --- .../8.clauses-and-options/ttl-options.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 255c3ecd482..48b677631d6 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 @@ -26,10 +26,20 @@ Vertex property expiration has the following impact. * If a vertex has multiple tags, once a property of the vertex expires, properties bound to the same tag with the expired property also expire, but the vertex does not expire and other properties of it remain untouched. + +!!! caution + + - When the TTL options are set for a property 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 and the TTL options are set for the property, the history data related to the tag will never expire because the value of that property for the history data is the current timestamp. + ### Edge property expiration Since an edge can have only one edge type, once an edge property expires, the edge expires. +!!! caution + + If a property with a default value of `now()` is added to a tag and the TTL options are set for the property, the history data related to the tag will never expire because the value of that property for the history data is the current timestamp. + ### Data deletion The expired data are still stored on the disk, but queries will filter them out. @@ -49,11 +59,6 @@ The native nGQL TTL feature has the following options. |`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` or `now()`, the property never expires. - ## Use TTL options You must use the TTL options together to set a valid timeout on a property. From 0abce4848d91fae7d9ca37fe378af8fd8d16d10e Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Fri, 6 Jan 2023 20:46:13 +0800 Subject: [PATCH 3/3] Update ttl-options.md --- .../8.clauses-and-options/ttl-options.md | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) 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 48b677631d6..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. @@ -26,20 +41,10 @@ Vertex property expiration has the following impact. * If a vertex has multiple tags, once a property of the vertex expires, properties bound to the same tag with the expired property also expire, but the vertex does not expire and other properties of it remain untouched. - -!!! caution - - - When the TTL options are set for a property 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 and the TTL options are set for the property, the history data related to the tag will never expire because the value of that property for the history data is the current timestamp. - ### Edge property expiration Since an edge can have only one edge type, once an edge property expires, the edge expires. -!!! caution - - If a property with a default value of `now()` is added to a tag and the TTL options are set for the property, the history data related to the tag will never expire because the value of that property for the history data is the current timestamp. - ### Data deletion The expired data are still stored on the disk, but queries will filter them out. @@ -50,15 +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.| - ## Use TTL options You must use the TTL options together to set a valid timeout on a property.