加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – Postgres否主键缺点[已关闭]

发布时间:2020-12-13 16:34:10 所属栏目:百科 来源:网络整理
导读:在Postgres中没有表的主键有什么缺点吗?由于所有数据在堆中无序存储,所以主键只是一个强制执行唯一键和索引的方法.或者主表中提供了一个基本功能,而不是没有主键的表? 根据Postgres文档(http://www. postgresql.org/docs/9.2/static/sql-createtable.html)
在Postgres中没有表的主键有什么缺点吗?由于所有数据在堆中无序存储,所以主键只是一个强制执行唯一键和索引的方法.或者主表中提供了一个基本功能,而不是没有主键的表?
根据Postgres文档(http://www. postgresql.org/docs/9.2/static/sql-createtable.html):

Technically,PRIMARY KEY is merely a combination of UNIQUE and NOT
NULL,but identifying a set of columns as primary key also provides
metadata about the design of the schema,as a primary key implies that
other tables can rely on this set of columns as a unique identifier
for rows.

从经验来看,我没有创造出许多表.没有主键的最大的缺点之一是,您可以通过外键没有参照完整性检查 – 因为该关系需要一个.我认为一些复制解决方案还需要一个主键,或者每行的单列标识符.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读