You need to enable JavaScript to run this app.
导航
system.cnch_binlogs
最近更新时间:2025.10.30 16:43:30首次发布时间:2025.10.30 16:43:30
复制全文
我的收藏
有用
有用
无用
无用

系统表 system.cnch_binlogs 展示某张表每个 Binlog part 的详细信息。读取 Binlog part 前,可使用该系统表查询详细信息,以此定制读取方式。如果只需要查询表最大和最小 BSN, 推荐查询 system.cnch_table_info,速度更快,开销更小。查询该系统表时,必须使用 database 和 table 的等值过滤条件。

使用限制

ByteHouse CDW 引擎版本为 v2.3 及以上版本可查看该系统表。您可登录 ByteHouse CDW 控制台,单击顶部租户管理页签,查看基础信息中的引擎版本。

列名

字段名称

数据类型

字段含义说明

database

String

查询的库名。

table

String

查询的表名。

part_name

String

当前 Binlog part 的名称。

bsn

UInt64

当前 Binlog part 的 BSN。

rows

UInt64

当前 Binlog part 的行数。

bytes

UInt64

当前 Binlog part 的存储字节数。

txn_id

UInt64

生成当前 Binlog part 的事务 ID。

commit_time

DateTime

生成当前 Binlog part 的事务的提交时间。

published_time

DateTime

当前 Binlog part 被发布的时间。

active

UInt8

当前 Binlog part 是否有效(在TTL内并且已发布)。

is_staged

UInt8

当前 Binlog part 是否已发布。

shard_stats

String

当前 Binlog part 内每个 Shard 的记录的行数。

示例

查询表 db_test.binlog_test 的所有 Binlog part 的信息:

SELECT
    database,
    table,
    bsn,
    rows,
    bytes,
    active,
    shard_stats
FROM system.cnch_binlogs
WHERE (database = 'db_test') AND (table = 'binlog_test') 

查询结果示例如下:

┌─database─┬─table───┬─bsn─┬─rows─┬─bytes─┬─active─┬─shard_stats────┐
│ db_test   │ binlog_test │   1 │    3  │  1416   │      1 │ [ 0, 1, 1, 1 ]     │
│ db_test   │ binlog_test │   2 │    5  │  1437   │      1 │ [ 0, 3, 2, 0 ]     │
│ db_test   │ binlog_test │   3 │    2  │  1403   │      1 │ [ 0, 1, 1, 0 ]     │
└──────┴────────┴───┴────┴──────┴─────┴────────────┘