表数据不变,同样的SQL多次执行结果不一致,是不是数据一致性有问题?

表里的数据没有任何变化,同样一条SQL多次执行结果不同.
表结构已经把敏感信息进行替换.
表结构:
CREATE TABLE abc_table (
R_C_Id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT ‘x’,
R_Date VARCHAR(25) NOT NULL COMMENT ‘x’,
R_hour INT(11) DEFAULT NULL COMMENT ‘x’,
U_id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
C_Id BIGINT(20) NOT NULL COMMENT ‘x’,
C_Name VARCHAR(500) NOT NULL COMMENT ‘x’,
P_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
P_Name VARCHAR(500) DEFAULT NULL COMMENT ‘x’,
C_S_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
S_M_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
P_Type INT(11) NOT NULL COMMENT ‘x’,
PR_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
PR_Name VARCHAR(500) DEFAULT NULL COMMENT ‘x’,
A_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
A_Name VARCHAR(500) DEFAULT NULL COMMENT ‘x’,
Ax_Id BIGINT(20) DEFAULT NULL COMMENT ‘x’,
Ax_Name VARCHAR(500) DEFAULT NULL COMMENT ‘x’,
Cx_Id BIGINT(20) NOT NULL COMMENT ‘x’,
Cx_Name VARCHAR(500) NOT NULL COMMENT ‘x’,
Cx_Type INT(11) NOT NULL COMMENT ‘x’,
Mx_Id VARCHAR(100) DEFAULT NULL COMMENT ‘x’,
Mx_Name VARCHAR(500) DEFAULT NULL COMMENT ‘x’,
cc DOUBLE DEFAULT NULL COMMENT ‘x’,
im BIGINT(20) DEFAULT NULL COMMENT ‘x’,
cl BIGINT(20) DEFAULT NULL COMMENT ‘x’,
ct FLOAT DEFAULT NULL COMMENT ‘x’,
cv BIGINT(20) DEFAULT NULL COMMENT ‘x’,
cv_r FLOAT DEFAULT NULL COMMENT ‘xxx’,
cv_cc FLOAT DEFAULT NULL COMMENT ‘xxx’,
v_p BIGINT(20) DEFAULT NULL COMMENT ‘xxx’,
v_p_or FLOAT DEFAULT NULL COMMENT ‘xxx’,
v_a_pt INT(11) DEFAULT NULL COMMENT ‘xxx’,
M_T VARCHAR(25) NOT NULL COMMENT ‘xxx’,
C_T VARCHAR(25) NOT NULL COMMENT ‘xxx’,
PRIMARY KEY (R_C_Id,R_Date),
KEY C_Id (C_Id,A_Id,M_Id,R_Date,R_hour),
KEY R_Date (R_Date)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=748486564 COMMENT=‘xxx’
PARTITION BY RANGE COLUMNS(r_date) (
PARTITION p202006 VALUES LESS THAN (“2020-07-01”),
PARTITION p202007 VALUES LESS THAN (“2020-08-01”),
PARTITION p202008 VALUES LESS THAN (“2020-09-01”),
PARTITION p202009 VALUES LESS THAN (“2020-10-01”),
PARTITION p202010 VALUES LESS THAN (“2020-11-01”),
PARTITION p202011 VALUES LESS THAN (“2020-12-01”),
PARTITION p202012 VALUES LESS THAN (“2021-01-01”),
PARTITION p202101 VALUES LESS THAN (“2021-02-01”),
PARTITION p202102 VALUES LESS THAN (“2021-03-01”),
PARTITION p202103 VALUES LESS THAN (“2021-04-01”),
PARTITION p202104 VALUES LESS THAN (“2021-05-01”),
PARTITION p202105 VALUES LESS THAN (“2021-06-01”),
PARTITION p202106 VALUES LESS THAN (“2021-07-01”),
PARTITION p202107 VALUES LESS THAN (“2021-08-01”),
PARTITION p202108 VALUES LESS THAN (“2021-09-01”),
PARTITION p202109 VALUES LESS THAN (“2021-10-01”),
PARTITION p202110 VALUES LESS THAN (“2021-11-01”),
PARTITION p202111 VALUES LESS THAN (“2021-12-01”),
PARTITION p202112 VALUES LESS THAN (“2022-01-01”),
PARTITION p202201 VALUES LESS THAN (“2022-02-01”)
)

为了方便查看结果,多个SQL组成union all结果如下:

SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
UNION ALL
SELECT SUM(cc),COUNT(1) FROM abc_table WHERE R_Date = ‘2021-05-11’
输出如下

SUM(cc) COUNT(1)
7084556.066868532 44639
7084556.066868532 44639
7084556.066868532 44639
14158795.552133694 89126
7084556.066868532 44639
14158795.552133597 89126
14158795.552133694 89126

请补充下 TiDB 版本信息

5.7.25-TiDB-v4.0.12

请问有tiflash节点吗?
能否反馈下explain analyze SQL 的结果。
最好包含两次结果不一样的,感谢

执行计划是走的tiflash,同事删掉相关表的tiflash设置,再重新添加就好了,目前偏向于tiflash的bug或者处理机制我们没有了解清楚.

我用union all把多个一样的SQL联起来,结果都不一样,请见我的问题描述.看执行计划,都是走的tiflash

建议升级到 v4.0.13 ,可能是这个问题 ,如果这个版本再遇到,可以查看 tiflash_error_log 存在报错 DB::Exception: Rows not found ,如果基本确认是这个问题。

谢谢回馈

您提供的页面,我打开404了,哈哈

抱歉,这个您先升级吧,下次可以查看报错信息。