Sequential GUIDs

后端 未结 5 2001
礼貌的吻别
礼貌的吻别 2020-12-08 23:02

I hope someone can answer this question.

How does the UuidCreateSequential method in the rpcrt4.dll class use to seed it\'s guids?

I know this much: Microsof

5条回答
  •  被撕碎了的回忆
    2020-12-08 23:25

    You could have a central table that has the last known starting UID for a range and increment it.

    eg: DB1 creates a GUID {AA333F14-FCCD-4bee-9F8F-9D9BDF1B8766} and writes this to the table. DB2 comes online and sees {AA333F14-FCCD-4bee-9F8F-9D9BDF1B8766} and increments it by some set number, like 1,000,000,000,000,000 or something really high so you won't have any overlapping values.

    But really, GUIDs are almost useless when used incrementally.

    I guess the really question is, what are you using GUIDs for? If you want an incrmenting number, just use a 64bit int(aka, bigint)

提交回复
热议问题