title: JOIN Performance: Composite key versus BigInt Primary Key
body: <p>We have a table that is going to be say 100 million to a billion rows (Table name: Archive)</p>
  
  <p>This table will be referenced from another table, Users.</p>
  
  <p>We have 2 options for the primary key on the Archive table:</p>
  
  <p>option 1:  dataID (bigint)</p>
  
  <p>option 2: userID  + datetime (4 byte version).</p>
  
  <p>Schema:</p>
  
  <p>Users
  - userID (int)</p>
  
  <p>Archive
  - userID
  - datetime</p>
  
  <p>OR</p>
  
  <p>Archive
  - dataID (big int)</p>
  
  <p>Which one would be faster?</p>
  
  <p>We are shying away from using Option#1 because bigint is 8 bytes and with 100 million rows that will add up to allot of storage.</p>
  
  <p><b>Update</b>
  Ok sorry I forgot to mention, userID and datetime have to be regardless, so that was the reason for not adding another column, dataID, to the table.</p>