doris icon indicating copy to clipboard operation
doris copied to clipboard

[Feature] Row-level TTL

Open TsukiokaKogane opened this issue 9 months ago • 4 comments

Search before asking

  • [x] I had searched in the issues 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:

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

TsukiokaKogane avatar Mar 05 '26 03:03 TsukiokaKogane

Thank you for your feature proposal and for your willingness to submit a PR!

Could you please provide some specific real-world use cases for row-level TTL? It would be very helpful to understand the concrete business scenarios where this feature is required to better evaluate its necessity and design.

morningman avatar Mar 06 '26 01:03 morningman

@morningman specific real-world use case: Logistics fulfillment as we use Doris unique table to track down the states of specific orders. We may use multiple partial updates to update different parts of order information with different order states. The most instinctive filters for data recycle is by the time of the whole order is completed, but the complete time could only be updated after the whole order is finished and the actual fulfillment time of an order may vary in a relative long period. It's hard for us to do data lifecycle management with partitioned table in such cases.

TsukiokaKogane avatar Mar 09 '26 11:03 TsukiokaKogane

Thank you for the detailed explanation. We look forward to your PR!

morningman avatar Mar 11 '26 00:03 morningman

We're closing this issue because it hasn't been updated in a while. If you'd like to revive this issue, please reopen it and feel free a maintainer to remove the Stale tag!

github-actions[bot] avatar Sep 07 '26 00:09 github-actions[bot]