title: How to speed up a search in a large sqlite database
body: <p>I'm trying to develop a Windows Phone app which is able to search for persons in a large(300,000 persons) sqlite database.
  The problem is that it takes half a minute to find a person.</p>
  
  <p>Do you have any idea how I could make the search faster?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var queryname = conn.Table&lt;contacts&gt;().Where(
      x =&gt;
          (
              ((x.firstName.ToLower() == input1) &amp;&amp; (x.lastName.ToLower() == input2))
              || ((x.firstName.ToLower() == input2) &amp;&amp; (x.lastName.ToLower() == input1))
              || ((x.firstName.ToLower() == input1) &amp;&amp; (x.lastName.ToLower().Contains(input2)))
              || ((x.lastName.ToLower().Contains(input1)) &amp;&amp; (x.firstName.ToLower() == input2))                                                                                                      
          ));
  
  var resultname = await queryname.ToListAsync();
  Person1.Content = null;
  foreach (var item in resultname)
  {
      outputname = string.Format("{0} {1}", item.firstName, item.lastName);
  }
  </code></pre>
  
  <p>Input 1 and 2 are the two words the user has typed in.</p>
  
  <p>Thank you in advance, </p>
  
  <p>Nadine</p>