DBA [SQLite] Primary Key discussion - Use guid or int ids ? #3123
-
For large projects I am used to create So I asked my self, also regarding drift, what is your opinion about this ? I am not so experienced with sqlite to answer that question my self but I thought maybe someone here has a better understanding about sqlite and this question :) Thx in advance! :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The sqlite3 documentation page on rowids is somewhat ambivalent on this. On the one hand, it suggests that using a single-integer primary key (aka the rowid) can be beneficial for performance:
On the other hand, it also offers this:
While drift supports I don't think it really depends on the size of the project, but rather the semantic meaning of the primary key and what you're comfortable with. If you have attributes sensibly forming a natural key (or have an existing guid key on a backend), use that one and perhaps disable rowids on the table. If you need a synthetic key, why not use the rowid for this since it exists and is a commonly used and optimized idiom in SQLite? |
Beta Was this translation helpful? Give feedback.
The sqlite3 documentation page on rowids is somewhat ambivalent on this. On the one hand, it suggests that using a single-integer primary key (aka the rowid) can be beneficial for performance:
On the other hand, it also offers this:
While drift supports
WITHOUT ROWID
tables (by overriding withoutRowId on the table), this is not the default.I don't think it really depends on the size of the project, but rather the semantic m…