1

A MySQL query is running significantly slower since adding a group_concat clause. 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. 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.

Can anyone help me to improve this query to improve its performance?

1 Answer 1

1

I was missing an index in the page_category.page_id field. That solve the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.