Skip to content

Commit

Permalink
add deleting data doc
Browse files Browse the repository at this point in the history
  • Loading branch information
wankai123 committed Aug 14, 2024
1 parent 6b83912 commit 7f98266
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 20 deletions.
20 changes: 0 additions & 20 deletions docs/interacting/bydbctl/schema/top-n-aggregation.md

This file was deleted.

52 changes: 52 additions & 0 deletions docs/interacting/deleting-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Delete Data in [Measures](../concept/data-model.md#measures) and [Streams](../concept/data-model.md#streams)

Due to the design of BanyanDB, the `Property` data provides [CRUD](./bydbctl/property.md) operations,
but the data in the `Measures and Streams` can not be deleted directly.
The data will be deleted automatically based on the [Groups](../concept/data-model.md#groups) `TTL` setting.

The TTL means the `time to live` of the data in the group.
Each group has an internal trigger which is triggered by writing events. If there is no further data, the expired data can’t get removed.

For example, the following command will create a group with a TTL of 7 days:
```shell
bydbctl group create -f - <<EOF
metadata:
name: sw_metric
catalog: CATALOG_MEASURE
resource_opts:
shard_num: 2
segment_interval:
unit: UNIT_DAY
num: 1
ttl:
unit: UNIT_DAY
num: 7
EOF
```
The data in this group will keep 7 days.

If you want to change the `TTL` of the data in this group to be 1 day, use the command:

```shell
bydbctl group update -f - <<EOF
metadata:
name: sw_metric
catalog: CATALOG_MEASURE
resource_opts:
shard_num: 2
segment_interval:
unit: UNIT_DAY
num: 1
ttl:
unit: UNIT_DAY
num: 1
EOF
```

More ttl units can be found in the [IntervalRule.Unit](../api-reference.md#intervalruleunit).

You can also manage the Group by other clients such as [Web-UI](./web-ui/schema/group.md) or [Java-Client](java-client.md).

## The API reference
- [Group Registration Operations](../api-reference.md#groupregistryservice)
- [ResourceOpts Definition](../api-reference.md#resourceopts)
2 changes: 2 additions & 0 deletions docs/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ catalog:
path: "/interacting/web-ui/property"
- name: "Java Client"
path: "/interacting/java-client"
- name: "Deleting Data"
path: "/interacting/deleting-data"
- name: "Operation and Maintenance"
catalog:
- name: "Configure BanyanDB"
Expand Down

0 comments on commit 7f98266

Please sign in to comment.