milvus-logo
LFAI
Home
  • User Guide

Release a Collection

This topic describes how to release a collection from memory after a search or a query to reduce memory usage.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.release()
await milvusClient.collectionManager.releaseCollection({
  collection_name: "book",
});
err := milvusClient.ReleaseCollection(
  context.Background(),                            // ctx
  "book",                                          // CollectionName
)
if err != nil {
  log.Fatal("failed to release collection:", err.Error())
}
milvusClient.releaseCollection(
  ReleaseCollectionParam.newBuilder()
    .withCollectionName("book")
    .build()
);
release -c book
Parameter Description
partition_name (optional) Name of the partition to release.
Parameter Description
collection_name Name of the collection to release.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to release.
Parameter Description
CollectionName Name of the collection to release.
Option Description
-c Name of the collection to release.
-p (Optional/Multiple) The name of the partition to release.

Constraints

  • Releasing the collection that is successfully loaded is allowed.
  • Releasing the collection is allowed when its partition(s) are loaded.
  • Error will be returned at the attempt to release partition(s) when the parent collection is already loaded. Future releases will support releasing partitions from a loaded collection, and loading the collection when its partition(s) are released.

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?