milvus-logo
LFAI
Home
  • User Guide

Create a Partition

This topic describes how to create a partition in Milvus.

Milvus allows you to divide the bulk of vector data into a small number of partitions. Search and other operations can then be limited to one partition to improve the performance.

A collection consists of one or more partitions. While creating a new collection, Milvus creates a default partition _default. See Glossary - Partition for more information.

The following example builds a partition novel in the collection book.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.create_partition("novel")
await milvusClient.partitionManager.createPartition({
  collection_name: "book",
  partition_name: "novel",
});
err := milvusClient.CreatePartition(
  context.Background(),   // ctx
  "book",                 // CollectionName
  "novel"                 // partitionName
)
if err != nil {
  log.Fatal("failed to create partition:", err.Error())
}
milvusClient.createPartition(
  CreatePartitionParam.newBuilder()
    .withCollectionName("book")
    .withPartitionName("novel")
    .build()
);
create partition -c book -p novel
Parameter Description
partition_name Name of the partition to create.
description (optional) Description of the partition to create.
Parameter Description
collection_name Name of the collection to create a partition in.
partition_name Name of the partition to create.
Parameter Description
ctx Context to control API invocation process.
CollectionName Name of the collection to create a partition in.
partitionName Name of the partition to create.
Parameter Description
CollectionName Name of the collection to create a partition in.
PartitionName Name of the partition to create.
Option Description
-c The name of the collection.
-p The partition name.
-d (Optional) The description of the partition.

Limits

FeatureMaximum limit
Number of partitions in a collection4,096

What’s next

Feedback

Was this page helpful?