milvus-logo

Release a Partition

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

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()
);
await milvusClient.GetCollection("book").ReleasePartitionAsync("novel");
// You can release a set of partititons as follows:
// await milvusClient.GetCollection("book").ReleasePartitionsAsync(partitionNames: new List<string> {
//     "novel",
//     "history"
// })
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.
Parameter Description
collectionName Name of the collection to release partitions.
partitionName / partitionNames Name of a partition or name list of the partitions to release.

Constraints

  • 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 (if needed) then loading some other partition(s).
  • "Load successfully" will be returned at the attempt to load the collection that is already loaded.
  • Error will be returned at the attempt to load the collection when the child partition(s) is/are already loaded. Future releases will support loading the collection when some of its partitions are already loaded.
  • Loading different partitions in a same collection via separate RPCs is not allowed.

What's next

On this page