milvus-logo
LFAI
Home
  • User Guide

Release a Partition

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

Since version 2.3.0, Milvus has enhanced its partition operations and now supports cascading load and release operations. This means that you can perform any combination of the following operations:

  • Release a loaded collection.
  • Release a specific partition from a loaded collection.
  • Release a loaded partition.
  • Release a collection that has part of partitions loaded.

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 Partition
partition = Partition("novel")       # Get an existing partition.
partition.release()
await milvusClient.releasePartitions({
    collection_name: "book",
    partition_names: ["novel"],
 });
err := milvusClient.ReleasePartitions(
  context.Background(),   // ctx
  "book",                 // CollectionName
  []string{"novel"},      // partitionNames
)
if err != nil {
  log.Fatal("failed to release partitions:", err.Error())
}
List<String> partitionNames = new ArrayList<>();
partitionNames.add("novel");
milvusClient.releasePartitions(
  ReleasePartitionsParam.newBuilder()
    .withCollectionName("book")
    .withPartitionNames(partitionNames)
    .build()
);
release -c book -p novel
curl -X 'DELETE' \
  'http://localhost:9091/api/v1/partitions/load' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "collection_name": "book",
    "partition_names": ["novel"],
    "replica_number": 1
  }'
Parameter Description
partition_name Name of the partition.
Parameter Description
collection_name Name of the collection to release partitions.
partition_names List of names of the partitions to release.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to release partitions.
partitionNames List of names of the partitions to release.
Parameter Description
CollectionName Name of the collection to release partition.
PartitionNames List of names of the partitions to release.

What's next