Use UUIDv4 for audit records PKs
kiler129 opened this issue · 2 comments
kiler129 commented
On larger systems the auto increment causes a table lock, which decreases performance. With UUIDv4 primary keys the whole UoW can be built and then flushed without any back-and-forth to the database.
I'm guessing one of the challenges can be sorting. However, a precise microsecond time stamp could solve it easily.
WDYT about such an addition?
dmitryuk commented
@kiler129 Can you provide any article about this behavior in database? Anyway you should create primary key - unique index will be checked for every entry before inserting.
janklan commented
My two cents of thoughts are:
- If you use UUID6, you can use the ID to sort the data in time-related order
- On a large system, wouldn't it make sense to log the events asynchronously anyway?