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.
In the select query for terms, add term name to avoid another database call for that.
$result = db_query(
db_rewrite_sql(
"SELECT t.tid, t.vid, t.name, v.module, xt.changed, xt.previously_changed, xt.priority_override
FROM {term_data} t
LEFT JOIN {vocabulary} v ON t.vid = v.vid
LEFT JOIN {xmlsitemap_taxonomy} xt ON t.tid = xt.tid",
't', 'tid'
)
);
Comment | File | Size | Author |
---|---|---|---|
#6 | 504004-taxonomy-term-D6-1.patch | 946 bytes | Dave Reid |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI'll take a look at it and make a decision for it.
Comment #2
Dave ReidWhat exactly is the call that is avoided?
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
apadernoRather than a
LEFT JOIN
, it would be better aINNER JOIN
, as we are not interested on taxonomy terms not associated with a vocabulary.Comment #5
akhil CreditAttribution: akhil commentedWhen implementing taxonomy_term_path hook in a module I need the term name as well but i could not get it as it is not being passed. So I will need to do another database call.
Comment #6
Dave ReidINNER JOINS are more expensive, and there should never be abandoned terms without a vocabulary. It's not possible if the proper Drupal APIs are used. I don't see a downside to including this. We should also skip loading the vocabulary table because taxonomy_term_path() will do that for us since it is used later.
Comment #7
Dave ReidCommitted to CVS.
http://drupal.org/cvs?commit=259498