메인 콘텐츠로 건너뛰기
MergeTree 테이블의 인덱스 파일과 마크 파일의 내용을 나타냅니다. 내부 검사에 사용할 수 있습니다.

구문

mergeTreeIndex(database, table [, with_marks = true] [, with_minmax = true])

인수

인수설명
database인덱스와 마크를 읽어올 데이터베이스 이름입니다.
table인덱스와 마크를 읽어올 테이블 이름입니다.
with_marks결과에 마크가 포함된 컬럼을 포함할지 여부입니다.
with_minmax결과에 MinMax 인덱스를 포함할지 여부입니다.

반환 값

프라이머리 인덱스와 min-max 인덱스(활성화된 경우)의 값을 담은 컬럼, 원본 테이블의 데이터 파트에 있는 가능한 모든 파일에 대한 마크(활성화된 경우) 값을 담은 컬럼, 그리고 가상 컬럼을 포함하는 테이블 객체입니다:
  • part_name - 데이터 파트의 이름입니다.
  • mark_number - 데이터 파트의 현재 마크 번호입니다.
  • rows_in_granule - 현재 granule의 행 수입니다.
데이터 파트에 해당 컬럼이 없거나 하위 스트림 중 하나의 마크가 기록되지 않은 경우(예: compact 파트), 마크 컬럼에는 (NULL, NULL) 값이 들어갈 수 있습니다.

사용 예시

CREATE TABLE test_table
(
    `id` UInt64,
    `n` UInt64,
    `arr` Array(UInt64)
)
ENGINE = MergeTree
ORDER BY id
SETTINGS index_granularity = 3, min_bytes_for_wide_part = 0, min_rows_for_wide_part = 8;

INSERT INTO test_table SELECT number, number, range(number % 5) FROM numbers(5);

INSERT INTO test_table SELECT number, number, range(number % 5) FROM numbers(10, 10);
SELECT * FROM mergeTreeIndex(currentDatabase(), test_table, with_marks = true);
┌─part_name─┬─mark_number─┬─rows_in_granule─┬─id─┬─id.mark─┬─n.mark──┬─arr.size0.mark─┬─arr.mark─┐
│ all_1_1_0 │           0 │               3 │  0 │ (0,0)   │ (42,0)  │ (NULL,NULL)    │ (84,0)   │
│ all_1_1_0 │           1 │               2 │  3 │ (133,0) │ (172,0) │ (NULL,NULL)    │ (211,0)  │
│ all_1_1_0 │           2 │               0 │  4 │ (271,0) │ (271,0) │ (NULL,NULL)    │ (271,0)  │
└───────────┴─────────────┴─────────────────┴────┴─────────┴─────────┴────────────────┴──────────┘
┌─part_name─┬─mark_number─┬─rows_in_granule─┬─id─┬─id.mark─┬─n.mark─┬─arr.size0.mark─┬─arr.mark─┐
│ all_2_2_0 │           0 │               3 │ 10 │ (0,0)   │ (0,0)  │ (0,0)          │ (0,0)    │
│ all_2_2_0 │           1 │               3 │ 13 │ (0,24)  │ (0,24) │ (0,24)         │ (0,24)   │
│ all_2_2_0 │           2 │               3 │ 16 │ (0,48)  │ (0,48) │ (0,48)         │ (0,80)   │
│ all_2_2_0 │           3 │               1 │ 19 │ (0,72)  │ (0,72) │ (0,72)         │ (0,128)  │
│ all_2_2_0 │           4 │               0 │ 19 │ (0,80)  │ (0,80) │ (0,80)         │ (0,160)  │
└───────────┴─────────────┴─────────────────┴────┴─────────┴────────┴────────────────┴──────────┘
DESCRIBE mergeTreeIndex(currentDatabase(), test_table, with_marks = true) SETTINGS describe_compact_output = 1;
┌─name────────────┬─type─────────────────────────────────────────────────────────────────────────────────────────────┐
│ part_name       │ String                                                                                           │
│ mark_number     │ UInt64                                                                                           │
│ rows_in_granule │ UInt64                                                                                           │
│ id              │ UInt64                                                                                           │
│ id.mark         │ Tuple(offset_in_compressed_file Nullable(UInt64), offset_in_decompressed_block Nullable(UInt64)) │
│ n.mark          │ Tuple(offset_in_compressed_file Nullable(UInt64), offset_in_decompressed_block Nullable(UInt64)) │
│ arr.size0.mark  │ Tuple(offset_in_compressed_file Nullable(UInt64), offset_in_decompressed_block Nullable(UInt64)) │
│ arr.mark        │ Tuple(offset_in_compressed_file Nullable(UInt64), offset_in_decompressed_block Nullable(UInt64)) │
└─────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────┘
마지막 수정일 2026년 6월 10일