apache / apache/doris

[Feature] Row-level TTL

Open
#61,056 4 comments 1 reaction 0 assignees View on GitHub
kind/feature Stale
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.

### Description

Currently, Apache Doris relies exclusively on dynamic partitions for data lifecycle management on aggregate model tables. Row-level TTL can help to improve query performance and reduce storage consumption.
Image

### Use case

Row-level TTL targets scenarios that require data expiration based on non-partition columns. It is applicable to date-range partitioned tables, LIST partitioned tables, and non-partitioned tables. Row-level TTL can work either with or without when Dynamic Partitioning is enabled.

Use Case:
```sql
CREATE TABLE example_db.example_tbl
(
k1 DATE,
k2 INT,
k3 SMALLINT,
v1 VARCHAR(2048),
v2 DATETIME DEFAULT "2014-02-04 15:36:00"
)
PARTITION BY RANGE (k1) ()
DISTRIBUTED BY HASH(k2) BUCKETS 32
PROPERTIES(
"function_column.ttl_col" = "v2",
"function_column.ttl" = "3d"
);
```

### Related issues

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.