Re:Auto increment is a terrible idea
by tatersolid on Thursday November 30, 2017 @06:23PM
(#15820587)
ULIDs are a much better answer than type-4 GUIDs. You get insertion-order sorting with a large random component to prevent collisions/guessing.
A similar solution called COMB identifiers dates back at least 15 years in the MSSQL community.
Watch out for sort order in MSSQL with binary ULIDs cast to UNIQUEIDENTIFIERs; they sort with the last 4 bytes as most significant, so some byte swapping is necessary to prevent the performance degradation caused by index page splitting (I wrote a ULID implementation for MSSQL that handles this).
A similar solution called COMB identifiers dates back at least 15 years in the MSSQL community.
Watch out for sort order in MSSQL with binary ULIDs cast to UNIQUEIDENTIFIERs; they sort with the last 4 bytes as most significant, so some byte swapping is necessary to prevent the performance degradation caused by index page splitting (I wrote a ULID implementation for MSSQL that handles this).
https://github.com/alizain/ulid