For tables with Binlog enabled, you can use this table to query the current table's maximum and minimum BSN. The query is fast and suitable for scenarios where only the table's maximum and minimum BSN need to be queried.
You can view this system table if the ByteHouse CDW engine version is v2.3 or above. You can log in to the ByteHouse CDW console, click the top Tenant management tab, and view the engine version in the basic information section.
| | | | \
| Name | Data type | Field description | |
|---|---|---|---|
| \ | |||
| database | String | Database name | |
| \ | |||
| table | String | Table name | |
| \ | |||
| min_bsn | Nullable(UInt64) | Minimum BSN within TTL. For tables without Binlog enabled or without Binlog, this field is NULL. | |
| \ | |||
| max_bsn | Nullable(UInt64) | Maximum BSN within TTL. For tables without Binlog enabled or without Binlog, this field is NULL. |
Query the maximum and minimum BSN of table db_test.binlog_test.
SELECT database, table, min_bsn, max_bsn FROM system.cnch_table_info WHERE (database = 'db_test') AND (table = 'binlog_test')
Example of query results:
┌─database─┬─table───┬─min_bsn─┬─max_bsn─┐ │ db_test │ binlog_test│ 10 │ 20 │ └──────┴────────┴──────┴──────┘