小编Dar*_*ter的帖子

ID、UUID 和“deleted_at”列,如何避免性能下降?

考虑PostgreSQL上的这张表,但有数千条记录:

\n\n
| id |    uuid | color    | ... |          deleted_at |\n|----|---------|----------|-----|---------------------|\n| 1  | 4fc1... | red      | ... | 2020-01-01 13:00:00 |\n| 2  | 4fc1... | gray     | ... | 2020-01-01 13:00:00 |\n| 3  | 4fc1... | blue     | ... |                null |\n| 4  | 4fc1... | red      | ... |                null |\n| 5  | 4fc1... | blue     | ... | 2019-12-03 00:45:00 |\n
Run Code Online (Sandbox Code Playgroud)\n\n

目的:

\n\n
    \n
  • id(自动增量)用作主键和主要挂钩,以与其他表一起使用 JOIN。
  • \n
  • uuid是用于识别记录的面向公众的值。
  • \n
  • deleted_at(timestamp|null) …

postgresql database-design primary-key index-tuning uuid

1
推荐指数
1
解决办法
3812
查看次数