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.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
curl -X 'DELETE' \
  'http://localhost:9091/api/v1/collection/load' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "collection_name": "book"
  }'
Output:
{}
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.

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

Feedback

Was this page helpful?