How to Set Replicas for All Tables at Once in TiFlash?

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

Original topic: tiflash怎么对所有表一次性设置副本?

| username: Jaimyjie

How can I set replicas for all tables in TiFlash at once?

| username: ShawnYan | Original post link

You might need

ALTER DATABASE db_name SET TIFLASH REPLICA count;
| username: tidb菜鸟一只 | Original post link

The comment above is correct. My suggestion is not to enable all tables; only enable the tables you need. Also, do not enable all tables at once; you can enable them in batches.

SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' SET TIFLASH REPLICA 1;') 
FROM INFORMATION_SCHEMA.tables a 
WHERE a.`TABLE_SCHEMA`='test' AND a.`TABLE_NAME` IN ('test1');
| username: Kongdom | Original post link

It is still necessary to first understand the function of TiFlash and why it is enabled. Enabling it does not mean that all queries will be fast.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.