What are the reasons *not* to use a GUID for a primary key?

后端 未结 8 1833
梦谈多话
梦谈多话 2020-12-24 02:24

Whenever I design a database I automatically start with an auto-generating GUID primary key for each of my tables (excepting look-up tables)

I know I\'ll never lose

8条回答
  •  余生分开走
    2020-12-24 02:52

    Simple answer: it's not relational.

    The record (as defined by the GUID) may be unique, but none of the associated attributes can be said to be occuring uniquely with that record.

    Using a GUID (or any purely surrogate key) is no more relational than declaring a flat file to be relational, on the basis that each record can be identified by its row number.

提交回复
热议问题