有一个子查询,它使用 GROUP_CONCAT 将结果分组到一个字段中。但是查询需要 3 秒才能运行,而没有运行需要 0.05 秒。我已经索引了附件.actionid 和 action.actionid 是 PK。有没有提高性能的解决方案?
SELECT
action.actiondate, acc.acc, acc.acccount
FROM
`action`
LEFT JOIN
(SELECT
actionid,
GROUP_CONCAT(accessory) AS acc,
COUNT(actionid) AS acccount
FROM
accessorieslink
GROUP BY actionid) AS acc
ON acc.actionid = action.actionid