在PolarDB相同的sql 通过代理地址执行百秒 通过主库地址查询秒级 有可能是什么原因?pi-2ze22jk4fo234eo77 执行节点 只读 数据是热数据。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
可能的原因有以下几点:
代理地址和主库地址的网络延迟不同,导致查询速度差异较大。可以通过ping命令或者traceroute命令检查网络延迟情况。
代理地址所在的服务器性能较低,导致查询速度较慢。可以查看服务器的CPU、内存等资源使用情况,以及磁盘I/O等指标。
数据库中的数据量较大,导致查询速度较慢。可以通过查看数据库表的大小、索引情况等来分析数据量是否较大。
SQL语句中存在性能瓶颈,导致查询速度较慢。可以通过查看SQL执行计划、慢查询日志等来分析SQL语句的性能问题。
数据库中的锁竞争较为激烈,导致查询速度较慢。可以通过查看数据库的锁等待情况来分析锁竞争情况。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云关系型数据库主要有以下几种:RDS MySQL版、RDS PostgreSQL 版、RDS SQL Server 版、PolarDB MySQL版、PolarDB PostgreSQL 版、PolarDB分布式版 。