GUID: varchar(36) versus uniqueidentifier GUID: varchar(36) versus uniqueidentifier sql-server sql-server

GUID: varchar(36) versus uniqueidentifier


Perhaps only the fact that you can 'read' them from a SELECT statement (although I don't think that's particularly useful as you can use a function in a select to make Uniqueidentifiers displayable).

If the table is large, saving 20 bytes per row is considerable.


I would go with uniqueidentifier for many reasons such as,

it will take less space; it's unique so it can not be duplicated. It's much better for comparisons and specially performance related issues as well as easy to get unique default value etc.

I would use uniqueidentifier unless I need to use varchar for very specific reason.


If your database is Oracle then the performance of indexes for raw data in older version of Oracle (9) was much, much poorer than indexing a varchar(36) field. Luckily this has changed in Oracle 10 and 11.