Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since no one made any answer, I will go ahead with my suggestion then.</p> <p>I think the best fit for your big database is using <code>remote</code> with <code>typeahead.js</code>. Quick example:</p> <pre><code>$('#user-search').typeahead({ name: 'user-search', remote: '/search.php?query=%QUERY' // you can change anything but %QUERY }); </code></pre> <p>What it does is when you type characters in the <code>input#user-search</code> it will send AJAX request to the page <code>search.php</code> with query as the content of the input.</p> <p>On <code>search.php</code> you can catch this query and look it up in your DB:</p> <pre><code>$query = $_GET['query'].'%'; // add % for LIKE query later // do query $stmt = $dbh-&gt;prepare('SELECT username FROM users WHERE username LIKE = :query'); $stmt-&gt;bindParam(':query', $query, PDO::PARAM_STR); $stmt-&gt;execute(); // populate results $results = array(); foreach ($stmt-&gt;fetchAll(PDO::FETCH_COLUMN) as $row) { $results[] = $row; } // and return to typeahead return json_encode($results); </code></pre> <p>Of course since your DB is quite big, you should optimize your SQL query to query faster, maybe cache the result, etc.</p> <p>On the typeahead side, to reduce load to query DB, you can specify <code>minLength</code> or <code>limit</code>:</p> <pre><code>$('#user-search').typeahead({ name: 'user-search', remote: '/search.php?query=%QUERY', minLength: 3, // send AJAX request only after user type in at least 3 characters limit: 10 // limit to show only 10 results }); </code></pre> <p>So it doesn't really matter how big your DB is, this approach should work nicely.</p> <p>This is an example in PHP but of course it should be the same for whatever backend you have. Hope you get the basic idea.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload