[英]group_concat query performance
A MySQL query is running significantly slower since adding a group_concat
clause. 自添加
group_concat
子句以来,MySQL查询的运行速度大大降低。 Currently, this query looks as follows: 当前,此查询如下所示:
select ... group_concat(distinct category.name) .... from page where
left outer join page_category on page.id = page_category.page_id
left outer join category on page_category.category_id = category.id
....
group by page.id
As mentioned in the query, among others, my application has 3 tables: page, category, and page_category. 如查询中所述,我的应用程序除其他外有3个表:page,category和page_category。 A page can be associated with none or multiple categories.
一个页面可以不具有任何类别,也可以不具有多个类别。 Currently page, page_category, and category have 9,460, 20,241 and 10 entries, respectively.
当前page,page_category和category分别有9,460、20,241和10个条目。
Can anyone help me to improve this query to improve its performance? 谁能帮助我改善此查询以提高其性能?
I was missing an index in the page_category.page_id field. 我在page_category.page_id字段中缺少索引。 That solve the problem.
那解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.