Reputation: 11
In PolarDB, identical SQL takes ~100 seconds via proxy versus sub-second query through primary node. What might be the reasons?
PI-2ze22jk4fo234eo77: read-only execution node; data is hot. SQL stored in sql.txt.
SELECT
msm.id AS caId,
msm.traineeMajorCode AS majorCode,
msm.NAME,
msm.account AS loginName,
msm.gendercode AS genderCode,
msm.identificationnumber AS IDCard,
msm.cellphone AS phoneNumber,
CONCAT_WS( '-', REPLACE ( dic1.dictionaryName, '角色', '' ), dic2.dictionaryName, dic3.dictionaryName ) AS humanTypeName,
msm.traineeyear AS referenceYear,
msm.specialitytitlecode AS specialitytitlecode,
hr_child.roleName AS allroles,
hd_child.departmentName AS departmentName,
CONCAT_WS( ',', sub1.majorName ) AS majorName,
m.id AS memberId
FROM
em_uums.t_institute mst
INNER JOIN em_uums.t_human_institute thi ON mst.id = thi.instituteId
INNER JOIN em_uums.t_human msm ON msm.id = thi.humanId
LEFT JOIN (
SELECT
hr.humanId,
GROUP_CONCAT( r.roleName ) AS roleName,
GROUP_CONCAT( hr.roleCode ) AS roleCode
FROM
em_uums.t_human_role hr
LEFT JOIN em_uums.t_role r ON r.roleCode = hr.roleCode
AND r.productCode = '20300'
WHERE
hr.instituteId = 'b2fd4660a03d45f7814345beefbc4bed'
AND hr.productCode = '20300'
GROUP BY
hr.humanId
) hr_child ON hr_child.humanId = thi.humanId
LEFT JOIN (
SELECT
hd.humanId,
GROUP_CONCAT( d.name ) AS departmentName,
GROUP_CONCAT( hd.departmentId ) AS departmentId
FROM
em_uums.t_human_department hd
LEFT JOIN em_uums.t_department d ON d.id = hd.departmentId
WHERE
hd.instituteId = 'b2fd4660a03d45f7814345beefbc4bed'
GROUP BY
hd.humanId
) hd_child ON hd_child.humanId = thi.humanId
LEFT JOIN em_uums.t_major sub1 ON sub1.majorCode = msm.traineeMajorCode
LEFT JOIN ex_t_member m ON m.caid = msm.id
LEFT JOIN em_uums.t_human_personneltype hp ON hp.humanId = msm.id
LEFT JOIN em_uums.t_dictionary dic1 ON dic1.dictionaryCode = msm.humanTypeCode
AND dic1.parentDictionaryCode = 'HumanType'
AND dic1.isDelete = '0'
LEFT JOIN em_uums.t_dictionary dic2 ON dic2.dictionaryCode = msm.personnelTypeCodes
AND dic2.parentDictionaryCode = 'PersonnelTypeCode'
AND dic2.isDelete = '0'
LEFT JOIN em_uums.t_dictionary dic3 ON dic3.dictionaryCode = msm.idtypeCode
AND dic3.parentDictionaryCode = 'IdType'
AND dic3.isDelete = '0'
WHERE
mst.id = 'b2fd4660a03d45f7814345beefbc4bed'
AND mst.deleted = '0'
AND ( 0 = 1 OR msm.NAME LIKE CONCAT( '%', '花卉', '%' ) )
AND msm.id NOT IN (
SELECT
temp2.caid
FROM
ex_t_exammember AS temp1
INNER JOIN ex_t_member AS temp2 ON temp1.memberid = temp2.id
AND temp1.paperid = '00000000609cf3bf0160d70ed92b62b3'
AND temp1.STATUS != '1'
)
GROUP BY
msm.id
ORDER BY
CONVERT ( msm.name USING GBK ) ASC
Network latency appears low when checked using either the ping or traceroute command.What other possible reasons could there be?
Upvotes: 0
Views: 26