执行过程:
set session tidb_isolation_read_engines=‘tiflash’;
set @@session.tidb_enforce_mpp=1;
set @@tidb_opt_agg_push_down = ON;
set @@tidb_opt_distinct_agg_push_down = 1;
set @@tidb_broadcast_join_threshold_size = 10000000;
set @@tidb_broadcast_join_threshold_count = 100000;
set session tidb_max_tiflash_threads = 20;
反复执行SQL,得出不同的结果
后来我进行优化,可以得出一致的结果:
set session tidb_isolation_read_engines=‘TiFlash,tikv,tidb’;让集群自动选择引擎,结果正常