Materialized MySQL

Materialized MySQL replicates the MySQL data into a materialized table in ByteHouse by reading the binlog of the MySQL database. This means that data will arrive in seconds, hence supporting change data capture (CDC) and real-time data analysis.


ByteHouse will create a database with MaterializedMySQL engine, and it will work as a replica of the corresponding database of MySQL. The first dump will read all data. Subsequently, any changes to the database will be read to ByteHouse.

Tables in ByteHouse are created by rewriting DDL into CNCHMergeTree. There is a background thread for each table in the MaterializedMySQL engine, which will schedule tasks.

SQL syntax

Create MaterializedMySQL engine

Optional settings

  • materialized_mysql_tables_list - By default, the engine will sync all the tables in the database. You can also define specific tables to sync in the settings.

  • cnch_vw_write - By default, we use an internal virtual warehouse for free. However, the free-tier limits performance. For better performance, we advise you to set a separate virtual warehouse for managing the data ingestion.

  • read_only_replica_info - Used for AWS RDS MySQL, which needs to provide a read replica for the first synchronization. e.g '{"host_name":"","port":"3306","user_name":"xxx","password":"xxx"}'

CREATE DATABASE db_mysql_sync_naga
ENGINE = CNCHMaterializeMySQL('', 'mysql_db_name', 'root', 'password')
[SETTINGS materialized_mysql_tables_list ='table,table2', 

Update MaterializedMySQL database

When you add or drop a table, you can use an update command, otherwise it may take up to 10 minutes for the change to sync.


Stop/start sync in SQL

  • You can pause the sync using "stop" and resume it using "start". Sync will resume from where it was left off.
system stop MATERIALIZEDMYSQL {materializedmysql_database_name}
system start MATERIALIZEDMYSQL {materializedmysql_database_name}

Drop the MaterializedMySQL engine

  • This will delete the synced data as well as the connection information.
drop database db_mysql_sync

User interface

The MaterializedMySQL user interface allows you to see the status of the database.

  • If MaterializedMySQL is running, it will show "Synchronizing" status.
  • When you stop the MaterializedMySQL engine via SQL, it will show "Stopped" status.
  • If the table sync threads are broken, it will show "Failed" status.


Go to Database --> Exception

  • This will return the last exception message which can either be a warning or a failure message. A warning message means that there are problems with the engine but it is still syncing. A failure message means that the sync threads are broken.
  • Note that MaterializedMySQL engine will continue to retry even in failed state unless it is "stopped".

Technical specifications

  • Only supports MySQL 5.7 and 8.0
  • Only syncs tables. Does not sync views and materialized views from MySQL
Source environment Support
Opensource MySQL
Volcano Cloud RDS for MySQL
Alicloud PolarDB for MySQL
Google CloudSQL Coming Soon

Note: AWS RDS MySQL needs to be prepared using the steps here AWS MySQL Replication.

DML Support

DDL Support
Create Table
Drop Table
Rename Table
Add Column
Drop Column
Rename Column
Modify Column