Retention policy on Measurement

Hi All, I have checked the previous post on these but not clear completely,Hence raising the question again.

1.Can we have retention at Measurement level or database level.If we have multiple retention based on Database/Measurement level which one will be take priority.Suppose if one of the retention says 1d and the other one is 2d, will the 2d gets priority and 1d will be get ignored.
2.If Retention is database level,Can’t we segregate measurements with different RP or All measurement has to follow the same defined RP at database level

It took me a bit to understand the whole structure, here is a summary that should answer your question

  • Retention Policy are at database level
  • Measurement are at database level
  • A single measurement can belong to several retention policies (can have points in any existing RP)
  • When you read or write data you always specify the RP and Measurement, if you don’t specify the RP, the default one is used.

about your second question:

  • you can have many RP and many measurements
  • you can use any combination of RP and Measurement (view it as a matrix)
  • You can’t strictly segregate measurements in different RPs, but you can specify which RP you want to use, leaving the others empty

a problem I had
When you delete data, you won’t be able to specify Measurement and RP
(Note: you should not delete data manually, let the RP manage that, but sometimes you might need to delete wrong data…)
so you can:

  • drop a measurement across all RPs
  • drop a RP across all measurements
  • Identify and drop single points or series in a specific measurement

A common solution to this kind of issue is to use a different measurement for data downsampling, here is a sample setup
RPs:

  • standard → duration of 14d
  • long → duration of 365d

Measurements:

  • sqlserver_cpu
  • sqlserver_cpu_hist
Measurement\RP standard long
sqlserver_cpu X
sqlserver_cpu_hist X

This helped me several times because when you do something wrong and have to delete data, it might not even be possible to identify and delete data if they share the same measurement.

I hope this helps