Timeline for InnoDB - Use combined index with primary key on GROUP BY
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 12, 2012 at 13:43 | comment | added | Michiel Thalen | Hmm you missed my last update, will do it again.. | |
Aug 12, 2012 at 13:02 | comment | added | ypercubeᵀᴹ | I meant edit the question not this answer :) Moved the info there. | |
Aug 12, 2012 at 12:52 | review | Suggested edits | |||
Aug 12, 2012 at 13:00 | |||||
Aug 12, 2012 at 12:44 | comment | added | ypercubeᵀᴹ |
We need the response table, not the licence one. And you can add the info in the question (click on Edit), no need for external links.
|
|
Aug 12, 2012 at 12:33 | comment | added | ypercubeᵀᴹ |
Please add the SHOW CREATE TABLE output for the 2 tables and the EXPLAIN plan
|
|
Aug 12, 2012 at 12:33 | comment | added | Michiel Thalen |
SELECT q.id AS q__id, q.user_id AS q__user_id, q.title AS q__title, q. NAME AS q__name, COUNT(r.id) AS r__0 FROM questionnaire q LEFT JOIN response r ON q.id = r.questionnaire_id WHERE ( q.user_id = 2 ) GROUP BY q.id ORDER BY q.updated_at DESC
|
|
Aug 12, 2012 at 12:29 | comment | added | Michiel Thalen | Ok I guess it was not clear that this is the actual query. I stripped out some parts which are not relevant. I DO use the JOIN and GROUP BY so i cannot leave it out. Selectivity has nothing to do with this. I use the "EXPLAIN" command to see which keys can be used, and what is going on. I could also just force a key, but still i can see the temp table and filesort. I will update with the real tables and query. | |
Aug 11, 2012 at 0:24 | history | edited | ypercubeᵀᴹ | CC BY-SA 3.0 |
added 697 characters in body
|
Aug 11, 2012 at 0:05 | history | edited | ypercubeᵀᴹ | CC BY-SA 3.0 |
added 297 characters in body; added 142 characters in body
|
Aug 10, 2012 at 23:59 | history | answered | ypercubeᵀᴹ | CC BY-SA 3.0 |