milvus数据库分区管理

一、创建分区

在创建集合时,会默认创建分区_default。
自己手动创建如下:

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.create_partition("novel")

二、检测分区

1.验证某一分区是否存在

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.has_partition("novel")

2.列出所有分区

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.partitions

三、删除分区

在指定集合中删除指定分区

from pymilvus import Collection
collection.drop_partition("novel")

四、加载分区

在加载集合时,已经将分区加载进去了。也可以单独加载分区

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.load(["novel"], replica_number=2)

from pymilvus import Partition
partition = Partition("novel")       # Get an existing partition.
partition.load(replica_number=2)

输出已加载的分区的信息:

from pymilvus import Partition
partition = Partition("novel")       # Get an existing partition.
partition.load(replica_number=2)     # Load partition as 2 replicas
result = partition.get_replicas()
print(result)

五、释放分区

from pymilvus import Partition
partition = Partition("novel")       # Get an existing partition.
partition.release()

你可能感兴趣的:(milvus数据库,数据库,milvus,oracle)