Retention policy

if a retention policy is created in a database and it is not set to default, will it keep deleting data form all the measurements from that database as per the specified duration?
E.g.
there is a database called testDB and inside it there are four measurements namely, testMeas, testMeas1, testMeas2 and testMeas3.

now if i execute the following command:
create retention policy “testRet” on “testDB” duration 1h replication 1

and then i do:
select first(*) into testRet.testMeas3 from testMeas

will it start deleting data which is older than one hour from every measurement or only from testMeas3?

Hi @neo1702,

data will be deleted in all measurements according to the retention policy they are in ,

best regards

Hi @MarcV,

Thank you for the help.
can you please also tell how can i know which measurement belongs to which retention policy?

For e.g.

if there are three measurements m1, m2 and m3 and two retention policies r1 and r2.
then how can i know which among the three measurements falls under r1 and which ones fall under r2.

Hi Neo , one method is as follows , I don’t know if there is a better method :

> precision rfc3339
> select * from neo.r1.m1 limit 1
name: m1
time                           tag1 val
----                           ---- ---
2019-06-17T10:02:09.136381867Z ok   9
> select * from neo.r2.m1 limit 1
> select * from neo.autogen.m1 limit 1
name: m1
time                           rp      val
----                           --      ---
2019-06-17T08:29:59.173727888Z autogen 1

Hi @MarcV,

thanks again. all this info is really helpful.
there’s one more thing i want to ask. if the duration of r1(retention policy) is set to 1h then r1 will delete data which is older than one hour… right?
one hour since when? the time of the creation of r1 or it will keep deleting data every 1h?

Hi Neo ,

the retention policy will be checked every check_interval ( see configfile )
and will remove data older than 1 hour

from my /etc/influxdb/influxdb.conf file …

[retention]
  enabled = true
  check-interval = "1500000h0m0s"     // this is an unrealistic vale for my testing :-)

best regards ,

Thanks a lot @MarcV.
this was really helpful.

:slight_smile:

Hi @MarcV,

so let’s say i create a retention policy r1 on database testDB:
create retention policy r1 on testDB duration 90d replication 1

this testDB has four measuremts m1, m2, m3 and m4. and the check-interval is set to 30m.
so retention policy will kich in each 30m and delete data from which measurement?

NOTE: in this situation the measurements were already existing and i just created the retention policy and did nothing afterwards