.NET: Avoid Using Guid.CreateVersion7
gist.github.comΒ·2hΒ·
Discuss: Hacker News
Flag this post

TL;DR: Guid.CreateVersion7 in .NET 9+ claims RFC 9562 compliance but violates its big-endian requirement for binary storage. This causes the same database index fragmentation that v7 UUIDs were designed to prevent. Testing with 100K PostgreSQL inserts shows rampant fragmentation (35% larger indexes) versus properly-implemented sequential GUIDs.

Guid.CreateVersion7 method was introduced in .NET 9 and is now included for the first time in a long-term-supported .NET 10. Microsoft docs for Guid.CreateVersion7 state β€œCreates a new Guid according to RFC 9562, following the Version 7 format.” **We will see about t…

Similar Posts

Loading similar posts...