https://docs.pingcap.com/zh/tidb/stable/use-tiflash-mpp-mode#控制是否选择-mpp-模式
注意
tidb_enforce_mpp=1
在生效时,TiDB 优化器会忽略代价估算选择 MPP 模式。但如果存在其它不支持 MPP 的因素,例如没有 TiFlash 副本、TiFlash 副本同步未完成、语句中含有 MPP 模式不支持的算子或函数等,那么 TiDB 仍然不会选择 MPP 模式。如果由于代价估算之外的原因导致 TiDB 优化器无法选择 MPP,在你使用
EXPLAIN
语句查看执行计划时,会返回警告说明原因,例如:set @@session.tidb_enforce_mpp=1; create table t(a int); explain select count(*) from t; show warnings;
+---------+------+-----------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+-----------------------------------------------------------------------------+ | Warning | 1105 | MPP mode may be blocked because there aren't tiflash replicas of table `t`. | +---------+------+-----------------------------------------------------------------------------+
你应该尝试show warnings
,这样会显示不能mpp的原因。