表里的数据没有任何变化,同样一条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 |