SQLite Forum

slow import of CSV files
Login
Dear SQLiters,

Evaluating steps to import CSV files (thank you again for explaining the process), I question if step 3 is needed. That is:

What is the difference between PRIMARY KEY and a separate UNIQUE index?

In general, I prefer constraints to be obvious in the table declaration. This argues for PRIMARY KEY. But I think that a separate UNIQUE index is just as efficient (and maybe internally is created for PRIMARY key). Advantage of the separate UNIQUE INDEX is ability to turn on and off its enforcement by dropping and recreating it. With this, maybe it is better to stop at step 2?

What is your recommendation? (I know it really is general and has little to do with the original question of importing CSV files)

Thank you,

Roman