v.21.6New Feature
Added Support for Replicas and Shards in MySQL/PostgreSQL Table Engine
Added support for replicas and shards in MySQL/PostgreSQL table engine / table function. You can write SELECT * FROM mysql('host{1,2}-{1|2}', ...). Closes #20969. #22217 (Kseniia Sumarokova).Why it matters
This feature enables users to efficiently query data distributed across multiple replicas and shards in MySQL and PostgreSQL by specifying multiple hosts in the connection string. It simplifies handling sharded and replicated setups from ClickHouse without manually managing multiple connections.How to use it
Use the table function or engine with a host pattern including replicas and shards in curly braces, for example:SELECT * FROM mysql('host{1,2}-{1|2}', 'database', 'table', 'user', 'password')This syntax expands to multiple hosts representing different replicas and shards.