What is Nostr?
Dave Mason /
npub1nfp…j3xp
2023-08-10 20:56:25

Dave Mason on Nostr: A recurring anti-pattern in SQL Server is to store GUIDs as strings. Consider this ...

A recurring anti-pattern in SQL Server is to store GUIDs as strings.

Consider this typical example, which is hyphenated:
AE753C1C-6007-4E8D-8DEC-035ACBDBBA9C

That's 36 characters, which requires 36 bytes of storage (on disk and in memory) for a VARCHAR/CHAR column.

The UNIQUEIDENTIFIER data type requires only 16 bytes of storage. Choosing the correct type saves 20 bytes. (It also 'constrains' the column, preventing non-GUIDs from being inserted.)

#SQLServer
Author Public Key
npub1nfpjcxgd32khk40m66k3j0u049g6kvuw92watj9lepmpmggcy43qy0j3xp