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

后端 未结 8 1819
梦谈多话
梦谈多话 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 03:04

    A potentially big reason, but one often not thought of, is if you might have to provide compatibility with an Oracle database in the future.

    Since Oracle doesn't have a uniqueid column data type, it can lead to a bit of a nightmare when you have two different data types for the same primary key across two different databases, especially when an ORM is involved.

提交回复
热议问题