Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 CreditAttribution: Damien Tournoud commentedc.name AS registered_name
andu.name AS registered_name
are 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 CreditAttribution: 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 CreditAttribution: sun.core commented