Start Debugging

guid

1 post

2026-12-03 csharpdotnetguid

Is Guid.CreateVersion7() sequential in .NET? Why two v7 GUIDs compare out of order

Guid.CreateVersion7() puts a millisecond timestamp in the top 48 bits and random data everywhere else, so two values created in the same millisecond come out in random order. Measured on .NET 11.0.0: 50% of back-to-back pairs are out of order, SQL Server sorts v7 values as if they were random, and EF Core only uses v7 by default on Npgsql. How to get a strictly monotonic UUIDv7 and how to opt in per EF Core provider.