How to load a large amount of users I have to perform actions on about 15000 users.
I'm using a query to retrieve all uids, but the script crashes when using the user_load_multiple

$uids = db_select('users', 'u')
          -&gt;fields('u', array('uid'))
          -&gt;condition('u.status', '1', '=')
          -&gt;execute()
          -&gt;fetchCol();

$users = user_load_multiple($uids);


The script is executed every night, in order to find all users for which the field "Contact again on" (field_contact_on) is empty. If it is empty, we put todays date + 1 year.

Does anyone has a suggestion on how to make this more efficient.

Thanks !
I was running into this issue as well. I ended up using EntityFieldQuery to pull my nodes. Then also went into my php.ini file and set my resource limit params to what I have pasted below.

max_execution_time = 1024     ; Maximum execution time of each script, in seconds
max_input_time = 2048   ; Maximum amount of time each script may spend parsing request data
memory_limit = 5048M      ; Maximum amount of memory a script may consume (8MB)


I've included my php module code below for your reference as well.

// go through player names and search
$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'content_type_name_to_pull')
  -&gt;propertyOrderBy('title', 'ASC')
  -&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 what you want with the node
  }
}