Is it possible to use a function which uses $node without the expense of node_load In cases where $node is not available but I know the nid, is it possible to mimic $node rather than using node load. I would like to try and cut the expense of performing a full node load..

For example to find a nodes taxonomy by vocab:

  $nid = 1;
  $vid = 1;
  $node = stdClass();
  $node-&gt;nid = $nid;
  $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);  


I have tried the above but it doesnt seem to work. I want to use the taxonomy_node_get_terms_by_vocabulary function but dont want the expense of having to use node_load to get the $node object
In this case, I would just look at the source for taxonomy_node_get_terms_by_vocabulary:

function taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid') {
  $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY weight', 't', 'tid'), $vid, $node-&gt;vid);
  $terms = array();
  while ($term = db_fetch_object($result)) {
    $terms[$term-&gt;$key] = $term;
  }
  return $terms;
}


The only thing needed is $node-&gt;vid.  Note that vid in this particular referes to node revision and not vocabulary ID.  If you knew the vid, then you could just create your own function:

function mytaxonomy_node_get_terms_by_vocabulary($nodevid, $vid, $key = 'tid') {
  $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY weight', 't', 'tid'), $vid, nodevid);
  $terms = array();
  while ($term = db_fetch_object($result)) {
    $terms[$term-&gt;$key] = $term;
  }
  return $terms;
}


The problem is that in most cases you don't know the $node-&gt;vid without doing a node_load.  Just querying using the nid may or may not be right if you use revisions or start using revisions in the futures.  The proper way to do it would be to JOIN the node table into the query so you can use $node-&gt;nid as an argument instead of $node-&gt;vid.