Skip to content

@tsdrivers/mssql / newCOMB

Function: newCOMB()

newCOMB(): string

Defined in: projects/ts-mssql/core/comb.ts:15

Generate a COMB (Combined GUID/Timestamp) UUID.

COMB UUIDs replace the last 6 bytes of a v4 UUID with a timestamp, producing UUIDs that are sequential over time. This dramatically improves INSERT performance and reduces index fragmentation in SQL Server's clustered UNIQUEIDENTIFIER indexes.

SQL Server sorts GUIDs by the last 6 bytes first (bytes 10-15), so the timestamp is placed there for correct sort ordering.

Returns

string

A COMB UUID string in standard format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

See

https://www.informit.com/articles/article.aspx?p=25862&seqNum=7