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
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