BrentOzarULTD / soddi

StackOverflow Data Dump Importer. Forked from https://bitbucket.org/bitpusher/soddi/ after the original author passed away.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to make Id fields identities

BrentOzar opened this issue · comments

Right now, every table has an Id field. It's not defined as an identity because in theory, users shouldn't be adding new rows to the Stack Overflow database - that just wasn't a goal for the export.

Unfortunately, with identity fields, you can't load them in parallel. To explicitly insert data into identity fields, you have to turn on identity_insert - but that can only be turned on for one table at a time:

https://docs.microsoft.com/en-us/sql/t-sql/statements/set-identity-insert-transact-sql

So we shouldn't do this by default across the board (because then everybody's loads will go slower).

Instead:

  • Add a checkbox on the main UI to "Set Ids as Identity Fields"
  • During table creations, define the Id field as an IDENTITY(1,1)
  • Load tables one at a time, using SET IDENTITY_INSERT ON/OFF

Closing.