milvus-logo

Load a Collection

This topic describes how to load the collection to memory before a search or a query. All search and query operations within Milvus are executed in memory.

In current release, volume of the data to load must be under 90% of the total memory resources of all query nodes to reserve memory resources for execution engine.
from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.load()
await milvusClient.collectionManager.loadCollection({
  collection_name: "book",
});
err := milvusClient.LoadCollection(
  context.Background(),   // ctx
  "book",                 // CollectionName
  false                   // async
)
if err != nil {
  log.Fatal("failed to load collection:", err.Error())
}
milvusClient.loadCollection(
  LoadCollectionParam.newBuilder()
    .withCollectionName("book")
    .build()
);
load -c book
Parameter Description
partition_name (optional) Name of the partition to load.
Parameter Description
collection_name Name of the collection to load.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to load.
async Switch to control sync/async behavior. The deadline of context is not applied in sync load.
Parameter Description
CollectionName Name of the collection to load.
Option Description
-c Name of the collection to load.
-p (Optional/Multiple) The name of the partition to load.

Constraints

  • Error will be returned at the attempt to load 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