Guru and Nubie

Renil’s Blog

IDs versus GUIDs

leave a comment »

This week, I was trying to understand the architecture of Windows Workflow Foundation (WF). In most of the sample programs I saw, they have used WorkflowInstanceId (a Guid) as the primary key in the database. The main reason being the use of instance id in Passivation (Passivation is the term WF is using to describe the process of moving idle workflow instances to persisent storage medium like database so that the program need not be in memory while waiting for some external stimulus like user input or input from other programs). They need to know the instance id to get the program back to memory.

During that time I had situation where I need to get the data from database based on the primary key. What about writing a query statement with a where clause like “where userid=’{BAE7DF4-DDF-3RG-5TY3E3RF456AS10}’”?. It’s difficult to write like that. So I did a search to know whether I should use Guid or integer key as primary key.

No need to search it any more. Find the Coding Horror article on Primary Keys: IDs versus GUIDs

-Nubie

Written by renil

March 23, 2007 at 6:44 pm

Posted in .NET 3.0, WF

Leave a Reply