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.
Every node has an author.
Comment | File | Size | Author |
---|---|---|---|
#1 | views_user_0.patch | 632 bytes | chx |
views_user.patch | 884 bytes | chx | |
Comments
Comment #1
chx CreditAttribution: chx commentedUh, uploaded an earlier attempt, sorry -- not every user has a role though :) Now really the trivial oneliner I wanted.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedPatch applied. Thanks!
Comment #3
FiReaNGeL CreditAttribution: FiReaNGeL commentedIf theres an author for every node, I guess that means that there is no use case where the author will be NULL. Then what you want is really a LEFT JOIN; INNER JOIN will cause mysql to check each row for null (to see if it can remove it from the dataset) and can cause some problems with indexes, causing performance degradation.
Comment #4
sunSo, what now? FiReaNG3L's argument seems to make sense...
Comment #5
FiReaNGeL CreditAttribution: FiReaNGeL commentedI guess we should compare both EXPLAIN for INNER and LEFT joins on sizable databases
Comment #6
sunComment #7
smk-ka CreditAttribution: smk-ka commentedAccording to EXPLAIN's output, it seems like FiReaNG3L is right. I didn't realize (until now) that you can rewrite INNER JOIN as LEFT JOIN t WHERE t.col IS NOT NULL (well, I knew the difference for sure, but I was under the impression INNER JOIN would be some kind of optimized, which seems not to be the case).
Comment #8
FiReaNGeL CreditAttribution: FiReaNGeL commentedThese EXPLAIN doesn't prove much as the query is a very simple one, and thus the EXPLAIN are very similar; maybe a 'real world' query with GROUP BY or ORDER BY and some WHERE, such as one generated by views.module, as the patch is for views, would be more appropriate. I still believe that the INNER is useless as there should be no case where a node has no author.
Comment #9
esmerel CreditAttribution: esmerel commentedNo changes are happening with 1.x