0

In a logging perspective with millions of rows. What is the preferred way?

Do you store the Guid as a UniqueIdentifier or in Binary? Which is faster for searching?

The C# part of generating the values is not an issue here.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Patrick
  • 5,442
  • 9
  • 53
  • 104
  • 1
    You didn't mention anything about indexes... I assume you do intend to index this column, right? Because that's *far* more important than choosing the right type (though the latter is also important). – Mark Byers Sep 20 '11 at 09:50

1 Answers1

4

A GUID is stored as binary but there are rules attached when comparing and sorting that are different to straight binary. See How is a guid actually stored and sorted/compared in SQL Server? for more

Whatever you choose, don't use a GUID a a clustered index. For why, see What are the reasons *not* to use a GUID for a primary key? as one example.

Community
  • 1
  • 1
gbn
  • 422,506
  • 82
  • 585
  • 676