list_persistent_segments()

This operation lists all persistent (flushed) segments for a collection, including information about row count, sort status, and storage level.

Request syntax

client.list_persistent_segments(
    collection_name: str,
    timeout: float = None
) -> List[SegmentInfo]

PARAMETERS:

  • collection_name (str) -

    [REQUIRED]

    The name of the collection.

  • timeout (float | None) -

    The timeout duration for this operation. Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURN TYPE:

List[SegmentInfo]

RETURNS:

A list of persistent segment information objects containing segment_id, collection_id, collection_name, num_rows, is_sorted, state, level, and storage_version.

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation.

Example

from pymilvus import MilvusClient

client = MilvusClient(
    uri="http://localhost:19530",
    token="root:Milvus"
)

segments = client.list_persistent_segments(collection_name="my_collection")
for seg in segments:
    print(f"Segment {seg.segment_id}: {seg.num_rows} rows, level={seg.level}")

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?