Why do the retention policy not work accurately


Here is the retention policy on “temp” database. The odd thing is that I set the retention policy 1 hour but 2-hour data is kept. What’s wrong with my retention policy? BTW, what’s exact function of replication? I read the document but I do not know its function.
Excuse my poor expression.
Thanks

Here is the visualization of “temp” database. It’s easy to see that 2-hour data has been kept

BTW!!! Why the old data will disapear when I change the retention policy?

Late reply ,but the old data doesn’t disappear. It’s just that the query uses the default retention policy to query. While the older data is still on the old retention policy.
You’d have to query:
SELECT “value” FROM “databasename”.“retentionpolicyname”.“measurement”

“Mostly answering for others that stumble uppon this”.
The reason for the “hourly” data saving more than 1 hour is because the data is stored in shards. Deleting that shard would delete the whole hour of data. Thus when querying the last hour of data at let’s say 17:00:01, you’d get no data, cause it just got deleted. That’s why influx keeps the data longer than the retention policy, to prevent that from happening.

1 Like

You can also refer to this blog post for a bit more information: Simplifying InfluxDB: Shards and Retention Policies.

1 Like