Product Documentation

MQTT V3 Plug-in Reference

Previous Topic

Next Topic

"tableRetentionPeriod"

  • Integer
  • Optional
  • Defaults to 0, which sets the data retention policy for this table to retain data indefinitely.

Sets the table to retain data for the age of this number of units. After that period, c-tree automatically purges older data.

Used to limit the amount of storage maintained.

The valid range of this property varies with the unit of measure, which is defined by "tableRetentionUnit"

The following are valid "tableRetentionPeriod" values for the specified unit types.

Unit type

Valid period values

"forever"

0

"minute"

1-33,554,431

"hour"

1-524,287

"day"

1-32,767

"week"

1-4,095

"month"

1-1,023

"year"

1-127

For example: you can set "tableRetentionPeriod" to 10 and "tableRetentionUnit" to "day" to cause the table to retain data only for the last 10 days. Data older than 10 days is automatically and permanently removed..

c-tree purges data very quickly and efficiently by creating one partition for each period. If "tableRetentionPeriod" is 10, then c-tree creates up to 10 partitions. When the age of a partition exceeds the retention period, c-tree deletes the partition.

Note: c-tree does not physically create a partition until data needs to be inserted into that partition.

Note: If data stops being inserted for a while, c-tree may not delete older partition files. Thus, c-tree may contain data that is older than the retention policy. The purpose of this feature is to limit data growth, not to ensure queries return data that only exists inside the specified retention policy.

When a table is set to retain data for a certain time period, "tableAutoTimeStamp" and "tableAutoTimeStampIndex" are automatically turned on. This is because they are required for data retention to work.

Note: You may specify only one "tableRetentionUnit" property. You cannot combine multiple retention units, such as “1 month and 15 days”.

Note: Automatic Purging is a FairCom Database feature that does the same thing as Table Retention, but from the opposite point of view — it purges data when it exceeds the retention period. The end result is the same.

Note: Child tables will use the same table retention policy as the parent table.

"AlterPersistenceTopic" cannot modify the retention period.

  • To change this property, you must delete the table and recreate the table with the desired settings.

TOCIndex