Depending on your use cases and scale requirements, GUIDs a good choice. An engineer at one of the companies I work with did a good chunk of research and we resolved to use integers for our use cases: http://www.google.com.au/webhp?ion=1#sclient=psy-ab&q=guids%20index%20fragmentation
My $0.02 is that if the scale of the data you're storing is low and you don't care about performance, use GUIDs. Otherwise I'd consider including a unique identifier for the occasionally connected client as a part of the key. On Thu, Feb 2, 2012 at 7:04 AM, Greg Kennedy <[email protected]> wrote: > +1 for guids. I use them as PK in a sync framework app. > > > On Thu, Feb 2, 2012 at 6:59 AM, David Ames <[email protected]> wrote: > >> ** ** >> >> If your only talking a small number of clients you can play with >> seed/increment values.**** >> >> ** ** >> >> Eg:**** >> >> Node 1: Seed = 1, Increment = +2**** >> >> Node 2: Seed = 2, Increment = +2**** >> >> Node 3: Seed = -1, Increment = -2**** >> >> Node 4: Seed = -2, Increment = -2**** >> >> ** ** >> >> ** ** >> >> You can also assign ranges (and run the risk of running out of numbers in >> the range)**** >> >> Node 1, Seed = 1**** >> >> Node 2, Seed = 100,000**** >> >> Node 3, Seed = 200,000**** >> >> Node 4, Seed = 300,000**** >> >> ** ** >> >> ** ** >> >> You could also use a GUID as the PK, set default = newSequentialid () to >> keep fragmentation down. **** >> >> ** ** >> >> Dave**** >> >> ** ** >> >> ** ** >> >> ** ** >> >> ** ** >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Kirsten Greed >> *Sent:* Thursday, 2 February 2012 7:52 AM >> *To:* 'ozDotNet' >> *Subject:* Making an application that uses identity keys occassionally >> connected**** >> >> ** ** >> >> Hi All**** >> >> I am interested in making my application occasionally connected.**** >> >> My app uses SQL Server and the tables have identity keys (auto >> incrementing numbers) **** >> >> I can see this will be a problem if I have 2 databases on separate >> computers because they will both want to assign a new record to the same >> key. **** >> >> Indeed when I experimented with Microsoft Sync Framework 2, this is what >> happened.**** >> >> Any advice on a strategy forward?**** >> >> Thanks**** >> >> Kirsten**** >> >> ** ** >> >> ** ** >> >> ** ** >> > > -- *David Connors* | [email protected] | www.codify.com Codify Pty Ltd Phone: +61 (7) 3210 6268 | Facsimile: +61 (7) 3210 6269 | Mobile: +61 417 189 363 V-Card: https://www.codify.com/cards/davidconnors Address Info: https://www.codify.com/contact
