How to iterate over all the nodes from a content type I want to recover some info from a field of all the nodes of a specific content type.
I know how to do it using a db_query and getting all the node ID then iterate over them.
What I would like to know is if there's is another way around this using drupal functions.
Drupal core provides a class called EntityFieldQuery().  There is also a handy document page for using it, that has lots of examples.  In its simplest form:

$query = new EntityFieldQuery();

$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'page')
  -&gt;propertyCondition('status', 1);

$result = $query-&gt;execute();

if (!empty($result['node'])) {
  $nids = array_keys($result['node']);
  $nodes = node_load_multiple($nids);

  foreach ($nodes as $node) {
    // do something awesome
  }
}


This will load all published nodes of type "page". You periodically need to adjust this to

$query = new EntityFieldQuery();

$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'page')
  -&gt;propertyCondition('status', 1);

$result = $query-&gt;execute();

if (!empty($result['node'])) {
  $nids = array_keys($result['node']);

 foreach ($nids as $nid) {
    $node = node_load($nid, NULL, TRUE);
    // do something awesome
  }
}


to avoid loading too much at once, which can cause memory issues.