The process moves data, schema, and workloads from ClickHouse’s columnar engine to MariaDB’s row-oriented storage using exports, transforms, and imports.
Teams move OLAP data into MariaDB when they need transactional consistency, wider ORM support, or lower operational overhead. MariaDB also suits mixed workloads that ClickHouse’s append-only design may hinder.
Install clickhouse-client
, MariaDB ≥10.5, and enough disk for an intermediate CSV or Parquet dump. Confirm both servers use the same UTC timezone to avoid timestamp drift.
Use clickhouse-client --query
with FORMAT CSV
or FORMAT Parquet
to stream tables into files or directly over STDOUT
. Split large tables per day to speed retries.
clickhouse-client --query="SELECT * FROM ecommerce.Customers" --format=CSV > customers.csv
Convert unsigned integers to signed, map DateTime64
to DATETIME(6)
, and flatten nested data. A lightweight Python or awk
script can adjust CSV headers before import.
Load with LOAD DATA INFILE
for fastest bulk speed. Disable foreign-key checks and autocommit during import, then re-enable to enforce integrity.
ClickHouse’s UInt64
becomes BIGINT
; LowCardinality(String)
becomes VARCHAR
with an index. Replace ENGINE = MergeTree
with InnoDB.
Match numeric precision exactly to avoid silent truncation of totals or prices.
ClickHouse partitions by month; replicate this with MariaDB PARTITION BY RANGE (TO_DAYS(order_date))
for large fact tables.
Run row counts and checksums in both systems. For example, compare SUM(total_amount)
per day in Orders
. Mismatches signal type or timezone errors.
Replicate new ClickHouse inserts to MariaDB via Kafka or an ETL tool while bulk import runs. Cut traffic once lag is near zero, then promote MariaDB to primary.
Keep ClickHouse in read-only mode for a grace period and swap DNS only after validation passes. This lets you revert instantly without data loss.
No official tool exists, but Debezium or custom Kafka pipelines can stream inserts from ClickHouse into MariaDB during cutover.
Flatten arrays into link tables (e.g., OrderItems) or serialize as JSON; choose based on query patterns.
Recreate views manually in MariaDB, translating ClickHouse functions to MySQL equivalents such as GROUP_CONCAT
or window functions.