# Data retention?

**URL:** <https://community.cratedb.com/t/data-retention/298>\
**Category:** CrateDB\
**Created:** [November 5, 2019, 10:41am UTC](https://community.cratedb.com/t/data-retention/298 "2019-11-05T10:41:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_Kaminski](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/roman_kaminski/32/135_2.png) [@Roman\_Kaminski](https://community.cratedb.com/u/Roman_Kaminski)\
**Post date:** [November 5, 2019, 10:41am UTC](https://community.cratedb.com/t/data-retention/298/1 "2019-11-05T10:41:59Z")

</div>

Vi there again.

I’m looking for something similar to retention policy from influxdb for cratedb.  
Or a settings or mechanism to configure data downsampling.  
If there isn’t any downsampling mechanism, is there a tool similar to curator for elasticsearch  
to delete old data?

Or should I, for now, implement cron that run delete command daily to delete it?

Best regards,  
Roman Kaminski

---

<div class="post-metadata">

**Author:** ![Roman\_Kaminski](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/roman_kaminski/32/135_2.png) [@Roman\_Kaminski](https://community.cratedb.com/u/Roman_Kaminski)\
**Post date:** [November 13, 2019, 11:43am UTC](https://community.cratedb.com/t/data-retention/298/2 "2019-11-13T11:43:57Z")

</div>

Allrighty,

I’m running crate 3.3.2 and found out solution to partition the table, then delete old tables:

“day\_\_generated” TIMESTAMP GENERATED ALWAYS AS date\_trunc(‘day’, “timestamp”),  
) PARTITIONED BY (“day\_\_generated”);

But I see no partitions being displayed on the “overview” page.  
Is this mechanism compatible with version 3 or I need to upgrade?

Roman

---

<div class="post-metadata">

**Author:** ![hernanc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hernanc/32/676_2.png) [@hernanc](https://community.cratedb.com/u/hernanc)\
**Post date:** [October 28, 2022, 3:38pm UTC](https://community.cratedb.com/t/data-retention/298/3 "2022-10-28T15:38:43Z")

</div>

Hi, partitioning by a generated column using `date_trunc` was already possible in version 3, but for downsampling you would probably be looking at using `date_bin` which was introduced in 4.7 so upgrading would be best if that is an option for you.  
Take a look at [Resampling time-series data with DATE\_BIN - Tutorials - CrateDB Community](https://community.cratedb.com/t/resampling-time-series-data-with-date-bin/1009)  
and [CrateDB and Apache Airflow: Implementation of a Data Retention Policy - Tutorials - CrateDB Community](https://community.cratedb.com/t/cratedb-and-apache-airflow-implementation-of-a-data-retention-policy/913).
