Comparison of Storage Space Size After MySQL Database Migration

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: MySQL数据库迁移后储存空间大小对比

| username: TiDBer_djgos04V

[TiDB Usage Environment] Production Environment
If I have a database with a storage size of 20GB in MySQL, will the storage size change after migrating to TiDB? By how much will it change?

| username: 像风一样的男子 | Original post link

This comparison is meaningless. MySQL is single-node, while TiDB has three-replica storage. Even if TiDB uses compressed storage, the cost will still be higher than MySQL.

| username: RenlySir | Original post link

Our extensive testing experience shows that migrating from a single MySQL instance with 100GB to TiDB with three replicas results in approximately the same 100GB.

Reference: “Besides, migrating to TiDB gave us an unexpected surprise. We conducted an evaluation, and if calculated over a two-year period, the cost of using TiDB is only 37% of MySQL. Why is that? Because TiDB has excellent data compression. According to our tests, the data in MySQL took up 10.8TB, but after migrating to TiDB, it was only 3.2TB, and this 3.2TB is the total data volume for three replicas. Therefore, the space usage ratio between MySQL and TiDB is 3.4:1.”

| username: cassblanca | Original post link

The default compression algorithms for TiKV RocksDB are LZ4 or ZSTD. Overall, considering different types and different dispersion ratios, the LZ4 compression ratio is around 4:1, while ZSTD is superior to LZ4 in both compression ratio and speed, achieving a compression ratio of 6:1 or even higher under ideal conditions. If we only look at the compression ratio, TiDB’s storage cost is definitely better than MySQL. However, TiDB is a distributed architecture with a default of 3 replicas, so the hardware cost is higher than the monolithic architecture of MySQL. Cost-effectiveness needs to be evaluated based on the business scenario and the input-output ratio, and it cannot be simply judged as better or worse.

| username: redgame | Original post link

The comparison will be smaller if it’s one-to-one, but you can’t compare three-to-one.

| username: TiDBer_vfJBUcxl | Original post link

TiDB has approximately 3 to 10 times the compression compared to MySQL (InnoDB), and a single TiDB instance has 3 replicas by default.

| username: zhanggame1 | Original post link

MySQL can also enable compression, but it is not enabled by default.

| username: tidb菜鸟一只 | Original post link

If it’s 3 replicas, it’s basically still this size.