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'
)
);

CommentFileSizeAuthor
#6 504004-taxonomy-term-D6-1.patch946 bytesDave Reid
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Category: bug » task

I'll take a look at it and make a decision for it.

Dave Reid’s picture

What exactly is the call that is avoided?

Anonymous’s picture

Version: 6.x-1.0-beta6 » 6.x-1.x-dev
Status: Active » Postponed
apaderno’s picture

Rather than a LEFT JOIN, it would be better a INNER JOIN, as we are not interested on taxonomy terms not associated with a vocabulary.

akhil’s picture

When 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.

Dave Reid’s picture

Status: Postponed » Needs review
FileSize
946 bytes

INNER 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.

Dave Reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.