Milvus
Zilliz
Home
  • User Guide
  • Home
  • Docs
  • User Guide

  • Manage Collections

  • Modify a Collection

Modify a collection

This topic describes how to modify the properties, especially the time to live (TTL), of a collection.

Currently, the TTL feature is only available in Python.

collection = Collection("books")
collection.set_properties(properties={"collection.ttl.seconds": 1800})
AlterCollectionParam alterCollectionParam = AlterCollectionParam.newBuilder
  .withCollectionName("books")
  .withTTL(1800)
client.AlterCollection(context.Background(), "books", entity.CollectionTTL(1800))

The example above changes the collection TTL to 1800 seconds.

ParameterDescriptionOption
Properties: collection.ttl.secondsCollection time to live (TTL) is the expiration time of data in a collection. Expired data in the collection will be cleaned up and will not be involved in searches or queries. Specify TTL in the unit of seconds.The value should be 0 or greater. The default value is 0, which means TTL is disabled.

TTL only happens after compaction which means the expired data will be invisible and GC after segment compacted.

Whatโ€™s next

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?