See was a index with execution plan, in addition to the count (*) to the count (primary key), and other optimization point? O bosses give directions (such as function the)
SELECT
COUNT (*) totalCount,
The SUM (the IF (t.R ESULT_FLAG='success', 1, 0)) successCount,
The SUM (the IF (b.E RROR_CODE='Y140', 1, 0)) unrecognizedCount,
The SUM (the IF (b.E RROR_CODE LIKE 'Y %' OR b.E RROR_CODE='E008', 1, 0)) connectCall,
The SUM (the IF (b.E RROR_CODE='N004', 1, 0)) hangupUnconnect,
The SUM (the IF (b.E RROR_CODE='Y001', 1, 0)) hangupConnect
The FROM
T ON b.T lbl_his b LEFT JOIN lbl_error_code ASK_ID=t.T ASK_ID AND t. ` CODE `=b.E RROR_CODE
WHERE
B.T ASK_ID="5 f460e4ffa99f51697ad4ae3"
AND biggest REATE_TIME BETWEEN "2020-07-01 00:00:00" AND "2020-10-28 00:00:00"
CodePudding user response:
I think to look my t.T ASK_ID b.T ASK_ID, tc ODE, b.E RROR_CODE and biggest REATE_TIME did this a few columns and indexes