开发者

GUID as uniq key with SQLite

I found GUID generation routine with python.

Running the code gives me the following results.

GUID: 00000129e0e72d9b2aab3c1500ac001000e90001
    Time:    Sat, 17 Jul 2010 09:55:33 (millis: 0.787)
    IP:      172.16.233.1
    Counter: 715865109

The comments of this code has the following message.

###   GUIDs make wonderful database keys.  They require no access to the 
###   database (to get the max index number), they are extremely unique, and they sort 
###   automatically by time.   GUIDs prevent key clashes when merging
###   two databases together, combining data, or generating keys in distributed
###   systems.

Questions

  • Does this work with SQLite? As far as I know INTEGER type in SQLite is 8 byte, and with 8 byte, it's not possible to store value 0x000开发者_运维知识库00129e0e72d9b2aab3c1500ac001000e90001 or 101362835865894089778560972572099193929729 in decimal.
  • Is there any way to get unique ID globally with SQLite?


Other than the fact that it takes up 32 bytes instead of 16, what's wrong with storing a GUID as text in SQLite?


Good article to help you get decision....

Primary Keys: IDs vs GUIDs:

http://www.codinghorror.com/blog/2007/03/primary-keys-ids-versus-guids.html


Every SQLite data row has a 64 bit locally-unique identifier. SELECT rowid FROM table...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜