• 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.

When interacting with Milvus using Python code, you have the flexibility to choose between PyMilvus and MilvusClient (new). For more information, refer to Python SDK.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
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())
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"
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.


  • 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