Note

This documentation is for a prior release of Kinetica. For the latest documentation, click here.

TTL

Time-to-live (TTL) is a configurable number of minutes since last access before a table or view will expire and be removed from the database. A TTL of -1 will direct that an entity not expire.

If a table or view is assigned a TTL, its expiration timer will be reset to the value of its configured TTL each time it is accessed. For instance, a view with a five minute TTL will have its life extended by five minutes from the time it is accessed every time it is accessed. If it is not accessed within five minutes from the time of last access, it will be removed.

Tables, by default, will not expire. Views, by default, will expire in the number of minutes configured within the server's default_ttl setting.

A TTL can be any of the following:

  • n - the database entity will live for n minutes since last access, where n is a positive integer
  • 0 - the database entity will expire immediately
  • -1 - the database entity will not expire

Note

TTL only governs an entity's expiration by timeout. For example, a memory-only table with a TTL set to not expire will still be removed from the system upon database restart, as it is a non-persisted entity.

Examples

To assign a 7-minute TTL to a table, in Python:

1
2
3
4
5
h_db.alter_table(
    table_name = "example.ttl_table",
    action = "ttl",
    value = "7"
)

To set a table to not expire, in Python:

1
2
3
4
5
h_db.alter_table(
    table_name = "example.ttl_table",
    action = "ttl",
    value = "-1"
)