why does it INNER JOIN users table ? we can take data from comments table directly
large data set , 250,000 comments
before:
15s
after patch:
3s
| Comment | File | Size | Author |
|---|---|---|---|
| comment.patch | 1.29 KB | droplet |
why does it INNER JOIN users table ? we can take data from comments table directly
large data set , 250,000 comments
before:
15s
after patch:
3s
| Comment | File | Size | Author |
|---|---|---|---|
| comment.patch | 1.29 KB | droplet |
Comments
Comment #1
damien tournoud commentedc.name AS registered_nameandu.name AS registered_nameare definitely not the same. That's why it is needed to join the users table. Not sure how that registered name is used down the road and if we can avoid it.Comment #2
damien tournoud commentedCrap. This is *again* a case where the MySQL query planner gets dumb:
Versus:
When the query is symmetric (all INNER JOINs), the query planner can order the tables the way it wants to. For some reason, it thinks that it will be easier to start from the {node} table, and get stuck with no index to do the sort on {comment}.timestamp. As soon as we make the query non-symmetric (by transforming the INNER JOIN to a LEFT JOIN), MySQL can satisfy the query from indexes alone.
Comment #4
sun.core commented