title: How to create two database records at the same time, that do not have sequential Ids
body: <p>We currently have a website with user login.</p>
  
  <p>We have a user table with userId.</p>
  
  <p>We now want users to have a duplicate profile, that is entirely seperate from their main profile. This needs to be a secret profile.</p>
  
  <p>Now we could just add two records into the db, but the id's would be sequential (until we hit a high hit rate of signups) so a user could workout that a userId would be related to one ID higher.</p>
  
  <p>I realise this is not an ideal solution, but it is a late change to a big software project so we are trying to be as pragmatic as possible, while requiring as little code change as possible.</p>
  
  <p>Options:</p>
  
  <ol>
  <li>Turn off auto increment Ids, and build our own keyGeneration table. Start one table at 0, and start the secret one at 1000000000. We then can then turn off auto incrementing ID's in the user table, and use these keys.</li>
  </ol>
  
  <p>The problem is, does having keys running, 1,1000000000,2,1000000001,3,1000000002 cause a massive indexing problem? Would we have to force index rebuilds all the time?</p>
  
  <ol>
  <li>We key a seperate table just for the 2nd profile id's, again starting at 10000000000. We then modify all our code to check for id's > 999999999 and flip the logic on the server side so the lookups work correctly.</li>
  </ol>
  
  <p>Means doing that check everywhere a user ID is passed into the site, from the front end.</p>
  
  <p>As we don't do that too much, (we obviously mainly grab userId of logged in user securely, it might not be that bad.</p>
  
  <p>Anyway, just wondering if anyone has any thoughts on this?</p>
  
  <p>///////Edit</p>
  
  <p>To put this into further context, imagine on stackoverflow or facebook, you have 2 profiles that you can control, that have no link between them. Like the way multiple users on Facebook can all act as a Page account, yet there is no link back from that account to the real user profile.</p>
  
  <p>Essentially to not break referential integrity or re write too much code, I really want to pass an ID (int) back down to the front end for these account. Then the whole system just keeps ticking over as it has done.</p>
  
  <p>Guid could be cool! But it would have a performance overhead (NOT THAT I CARE ABOUT THAT REALLY ;) but it would also mean writing a lot of code to handle Guids being what is passed to the front end (not that we rely on front end variables being right) but that is why I suggest the high int solution above. As we still have ASP.NET Membership lurking in the background I almost thought that could be good but A) we plan to remove that one day (or migrate to simple membership) b) we use sequential Guid generation in our user table for performance (sorry again to talk about optimization, before it's needed)</p>