The system table system.cnch_binlogs shows the details of each Binlog part for a given table. Before reading a Binlog part, you can use this system table to query details and customize the reading method accordingly. To query only the max and min BSN of a table, it is recommended to query system.cnch_table_info, which is faster and has lower overhead. When querying this system table, you must use equality filters for both database and table.
This system table can be viewed when the ByteHouse CDW engine version is v2.3 or above. You can log in to the ByteHouse CDW Console, click the Tenant Management tab at the top, and view the engine version in Basic info.
| | | | \
| Name | Data type | Field meaning description | |
|---|---|---|---|
| \ | |||
| database | String | The database name to query. | |
| \ | |||
| table | String | The table name to query. | |
| \ | |||
| part_name | String | The name of the current Binlog part. | |
| \ | |||
| bsn | UInt64 | The BSN of the current Binlog part. | |
| \ | |||
| rows | UInt64 | The number of rows in the current Binlog part. | |
| \ | |||
| bytes | UInt64 | The number of storage bytes for the current Binlog part. | |
| \ | |||
| txn_id | UInt64 | The transaction ID that generated the current Binlog part. | |
| \ | |||
| commit_time | DateTime | The commit time of the transaction that generated the current Binlog part. | |
| \ | |||
| published_time | DateTime | The time when the current Binlog part was published. | |
| \ | |||
| active | UInt8 | Whether the current Binlog part is active (within TTL and published). | |
| \ | |||
| is_staged | UInt8 | Whether the current Binlog part is published. | |
| \ | |||
| shard_stats | String | The number of records for each Shard in the current Binlog part. |
To query all Binlog part information of the table db_test.binlog_test:
SELECT database, table, bsn, rows, bytes, active, shard_stats FROM system.cnch_binlogs WHERE (database = 'db_test') AND (table = 'binlog_test')
Query results examples are as follows:
┌─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 ] │ └──────┴────────┴───┴────┴──────┴─────┴────────────┘