Using “varchar” as the primary key? bad idea? or ok?

前端 未结 5 2052
一整个雨季
一整个雨季 2021-01-01 12:43

Is it really that bad to use \"varchar\" as the primary key?

(will be storing user documents, and yes it can exceed 2+ billion documents)

5条回答
  •  忘掉有多难
    2021-01-01 13:30

    It totally depends on the data. There are plenty of perfectly legitimate cases where you might use a VARCHAR primary key, but if there's even the most remote chance that someone might want to update the column in question at some point in the future, don't use it as a key.

提交回复
热议问题