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

前端 未结 5 2031
一整个雨季
一整个雨季 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:31

    Use an ID (this will become handy if you want to show only 50 etc...). Than set a constraint UNIQUE on your varchar with the file-names (I assume, that is what you are storing).

    This will do the trick and will increase speed.

提交回复
热议问题