system-index-blocks

Retrieves partition and segment-level metadata for table indexes. The terms, termlimit, blocklimit, and blockoffset options themselves are available in both series. Merged indexes — the merged-segment rows, the posting_offset term field, and the way blocklimit/blockoffset span a partition's regular and merged segments as one combined stream — are available starting with 4.0.2609.0. The 5.0 series (through 5.0.2605.2) has no merged indexes, so this command returns only regular (V3) segment rows there.

Command properties

PropertyDescription
Command typeDriver query
Required permissionNone (table read permission required)
License usageNot counted
Parallel executionNot supported
Distributed executionNot supported

Syntax

system-index-blocks table=TABLE index=INDEX [day=DATE] [sk=HEX] [era=LONG] [terms={t|f}] [termlimit=LONG] [blocklimit=LONG] [blockoffset=LONG]

Options

table=TABLE
Name of the table to query. This option is required.
index=INDEX
Name of the index to query. This option is required.
day=DATE
Partition date in yyyyMMdd format. If not specified, all partitions are queried.
sk=HEX
Partition sub-key as a hexadecimal long value. If not specified, the retrieval range is not restricted.
era=LONG
Partition identifier. If not specified, the retrieval range is not restricted.
terms={t|f}
Retrieves term data for each index field. (Default: f)
  • t: Include term data in the results
  • f: Do not retrieve term data
termlimit=LONG
When terms=t, limits the number of term rows returned. Must be used together with terms=t. For a regular (V3) segment, this limit is applied per field; for a merged segment, it is applied per tree kind (string, integer, timestamp, IPv4, IPv6).
blocklimit=LONG
Limits the maximum number of segments (blocks) to retrieve. This is applied to the combined stream of a partition's regular (V3) segments and merged segments (if multiple partitions are queried, this limit is applied separately to each partition).
blockoffset=LONG
Specifies the starting position of segments to retrieve. (Default: 0) This skips from the front of the combined stream of a partition's regular (V3) segments and merged segments, applied separately per partition.

Output fields

Base segment information fields:

FieldTypeDescription
tablestringTable name
indexstringIndex name
partitionstringPartition identifier string
sto_classintegerStorage class number. 0–9,999: Hot tier, 10,000–19,999: Warm tier, 20,000–29,999: Cold tier
sto_pathstringAbsolute path of the directory where segment files are stored. For a merged-segment row, this is the absolute path of the .merged directory.
seg_idlongSegment ID. Not returned for a merged-segment row (null).
min_idlongMinimum record ID in the segment. Not returned when reserved is true or for a merged-segment row (null).
max_idlongMaximum record ID in the segment. Not returned when reserved is true. For a merged-segment row, this returns the overall maximum record ID indexed, or null if it cannot be determined.
min_timetimestampMinimum timestamp in the segment. Not returned for a merged-segment row (null).
max_timetimestampMaximum timestamp in the segment. Not returned for a merged-segment row (null).
verlongSegment version. Not returned when reserved is true. For a merged-segment row, this returns 4 (the merged index version).
reservedbooleanWhether the segment is reserved. Not returned for a merged-segment row (null).
field_cntintegerNumber of fields in the segment
seg_offsetlongStart offset of the segment data. Not returned for a merged-segment row (null).
fieldsstringList of fields. Displayed per line in fieldname:type:termblocksize format. For a merged-segment row, this uses the same format to display fieldname:type:posting file size (bytes).

Additional fields returned when terms=t is specified:

FieldTypeDescription
field_namestringName of the field the term belongs to
field_typestringField type (one of STRING, INT, TIME, IPV4, IPV6)
termstring or longTerm value
posting_countlongNumber of records containing the term
posting_offsetlongStart offset of the term's posting data. Returned only for a term row from a merged segment; not returned for a term row from a regular (V3) segment (null).

A term row from a regular (V3) segment returns only seg_id, field_name, field_type, term, and posting_count. A term row from a merged segment returns these plus table, index, partition, sto_class, sto_path, and posting_offset, with one row returned per term-and-field pair (for example, when the same term appears in multiple fields).

Error codes

Parsing errors
Error codeMessageDescription
95061missing-table-optionTable name was not specified
95062missing-index-optionIndex name was not specified
95063invalid-table-nameTable name is invalid
95064no-table-read-permissionThe user does not have read permission for the table
95113invalid-day-optionThe day value is not in yyyyMMdd format
95114invalid-sk-optionThe sk value is not a valid hexadecimal long
95115invalid-era-optionThe era value is invalid
95117invalid-long-valueThe termlimit, blocklimit, or blockoffset value is invalid
95118termlimit-option-given-without-termstermlimit was specified without terms=t
Runtime errors
Error codeMessageDescriptionPost-processing
95064no-table-read-permissionThe user does not have read permission for the tableQuery aborted
92003table-not-existThe specified table does not existQuery aborted
92005missing-indexThe specified index does not existQuery aborted

Description

The system-index-blocks command retrieves segment-level metadata for table indexes. You can view each segment's ID, timestamp range, storage class, storage path, and field information.

If the queried partition has a merged index (a .merged directory), merged-segment rows are returned together with the regular (V3) segment rows in the same query result. A merged-segment row is not per individual segment; one row is returned per tree kind in the merged index (string, integer, timestamp, IPv4, IPv6), and the seg_id, min_id, min_time, max_time, reserved, and seg_offset fields are not returned for these rows (null).

When the terms=t option is specified, term data for each field is also returned in addition to the segment records. The termlimit option limits the number of term rows and must be used together with terms=t. This limit is applied separately per field for regular (V3) segments, and per tree kind for merged segments.

Use the blocklimit and blockoffset options to restrict the range of segments to retrieve, enabling paginated retrieval of large indexes. Both options are applied to the combined stream of a partition's regular (V3) segments and merged segments — if multiple partitions are queried, the limit is applied separately to each partition, and it does not directly limit the total number of result rows.

Examples

  1. Retrieve segments for a specific table index

    system-index-blocks table=SONAR_EVENTS index=default_idx
    

    Retrieves the segment list for the default_idx index of the SONAR_EVENTS table.

  2. Retrieve segments for a specific date partition

    system-index-blocks table=SONAR_EVENTS index=default_idx day=20260301
    

    Retrieves segments for the March 1, 2026 partition of the default_idx index in the SONAR_EVENTS table.

  3. Retrieve with term data included

    system-index-blocks table=SONAR_EVENTS index=default_idx day=20260301 terms=t termlimit=10
    

    Retrieves segments for the March 1, 2026 partition along with up to 10 term entries per field.

  4. Retrieve with a segment count limit

    system-index-blocks table=SONAR_EVENTS index=default_idx blocklimit=100
    

    Retrieves up to 100 segments for the default_idx index of the SONAR_EVENTS table.

  5. Retrieve only merged segments (4.0 series, 4.0.2609.0 and later)

    system-index-blocks table=SONAR_EVENTS index=default_idx
    | search ver == 4
    

Change history

TargetIntroduced in
The system-index-blocks commandBefore Sonar 4.0
Returning merged segment rows4.0.2609.0
Applying the blockoffset and blocklimit options to the unified stream4.0.2609.0
The posting_offset field of terms=t4.0.2609.0