Best way to deal with long list I've an entity called "guy" with a field "location" and i've 9-10.000 location that i want to reference. I must use a simple list (1|bla, 2|blabla) or an entity reference field that target the location entity? I need the autocomplete function but drupal is very slow with a great number of location. But i don't know if i can load a list of 9-10k lines.
I don't wont to use taxonomy.
To speed up the autocomplete, how i can create a list of frequently selected location?
I dont think there is a module you can use. 

The form will contain an element such as

&lt;?php
  $form['city'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; 'City',
    '#maxlength' =&gt; 128,
    '#autocomplete_path' =&gt; 'cities/autocomplete',
  );
?&gt;


Addition to hook_menu

You must add #autocomplete_path to your hook_menu function.

&lt;?php
    function cities_menu(){
    ...
    // path with autocomplete function for cities
    $items['cities/autocomplete'] = array(
      'title' =&gt; 'Autocomplete for cities',
      'page callback' =&gt; '_cities_autocomplete',
      'access arguments' =&gt; array('use autocomplete'),  //or whatever permission makes sense
      'type' =&gt; MENU_CALLBACK
    );
    return $items;
?&gt;


Make a call to the Database.

&lt;?php
/**
 * autocomplete helper
 * $string = string for search
 */
function _cities_autocomplete($string) {
  // Fetch most used cities. 
  $matches = array();
  $result = db_select('cities', 'c')
    -&gt;fields('c', array('city'))
    -&gt;condition('city', '%' . db_like($string) . '%', 'LIKE')
    -&gt;execute();

  // save the query to matches
  foreach ($result as $row) {
    $matches[$row-&gt;city] = check_plain($row-&gt;city);
  }

  // Return the result to the form in json
  drupal_json_output($matches);
}
?&gt;


Make sure your autocomplete handler has appropriate menu permissions set on it,

From : Textfield that uses autocomplete