在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.
从经验来看,我没有创造出许多表.没有主键的最大的缺点之一是,您可以通过外键没有参照完整性检查 – 因为该关系需要一个.我认为一些复制解决方案还需要一个主键,或者每行的单列标识符.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。