title: Storing facebook information efficiently in a database for future queries
body: <p>I am creating a website that has the option for users to login via facebook, and when a user logs in, my database would store his/her information obtained from facebook. </p>
  
  <p>The SQL code that created the table is:</p>
  
  <pre><code>CREATE TABLE facebook_users (
      user_id BIGINT NOT NULL, 
      username varchar(255),
      firstname varchar(255),
      lastname varchar(255),
      email varchar(255), 
      PRIMARY KEY (user_id)
  )
  </code></pre>
  
  <p>an example of one row of the information provided by facebook would be:</p>
  
  <pre><code>user_id:    241123463541244
  username:   John Smith
  firstname:  John
  lastname:   Smith
  email:      johnsmith1977@gmail.com
  </code></pre>
  
  <p>Every time a user logs in, my website would check if a row already exists with that user_id, and if it didn't would create it and insert the appropriate informaiton:</p>
  
  <pre><code>$user_id = 241123463541244;//obtained from facebook via the access_token
  
  $sqlStatement = "SELECT EXISTS(SELECT 1 FROM table1 WHERE user_id = ".$user_id.")";
  $sqlStatementPrepared = $conn-&gt;prepare($sqlStatement);
  $sqlStatementPrepared-&gt;execute();
  
  $row = $sqlStatementPrepared-&gt;fetch();
  
  if ($row === false)
  {
      //code that inserts a new row into the facebook_users table     
  }
  </code></pre>
  
  <p>My concern is that the current user_id would cause speed issues for future queries when the database grows to over 1 million rows (or 10 million, etc), especially considering that the rows would be created one after the other when a new facebook user logs in for the first time, which means that the user_id values are not in an increasing or decreasing order.</p>
  
  <p><strong>QUESTIONS:</strong> Will the current MySQL format cause speed issues for future queries when the database grows to over 1 million rows? If so, is there a better method I could use to increase performance?</p>