milvus-logo
Star
0
Forks
0
快速开始

Compact Data

Milvus Docs 需要你的帮助

本文档暂时没有中文版本,欢迎你成为社区贡献者,协助中文技术文档的翻译。
你可以通过页面右边的 编辑 按钮直接贡献你的翻译。更多详情,参考 贡献指南。如需帮助,你可以 提交 GitHub Issue

This topic describes how to compact data in Milvus.

Milvus supports automatic data compaction by default. You can configure your Milvus to enable or disable compaction and automatic compaction.

If automatic compaction is disabled, you can still compact data manually.

To ensure accuracy of searches with Time Travel, Milvus retains the data operation log within the span specified in common.retentionDuration. Therefore, data operated within this period will not be compacted.

Compact data manually

Compaction requests are processed asynchronously because they are usually time-consuming.

from pymilvus import Collection
collection = Collection("book")      # Get an existing collection.
collection.compact()
const res = await milvusClient.collectionManager.compact({
  collection_name: "book",
});
const compactionID = res.compactionID;
// This function is under active development on the GO client.
R<ManualCompactionResponse> response = milvusClient.manualCompaction(
    ManualCompactionParam.newBuilder()
        .withCollectionName("book")
        .build());
long compactionID = response.getData().getCompactionID();
compact -c book
Parameter Description
collection_name Name of the collection to compact data.
Parameter Description
CollectionName Name of the collection to compact data.
Option Description
-c Name of the collection to compact data.

Check compaction status

You can check the compaction status with the compaction ID returned when the manual compaction is triggered.

collection.get_compaction_state()
const state = await milvusClient.collectionManager.getCompactionState({
    compactionID
});
// This function is under active development on the GO client.
milvusClient.getCompactionState(GetCompactionStateParam.newBuilder()
        .withCompactionID(compactionID)
        .build());
show compaction_state -c book

What's next

该页面是否对你有帮助?
本页目录