主索引的搜索键是否必须与主键相关或与之相关? [英] Must the search key of a primary index be or related to the primary key?

查看:203
本文介绍了主索引的搜索键是否必须与主键相关或与之相关?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 https://stackoverflow.com/a/51087864/3284469


主键可以是主索引。

primary keys can be primary indices.

主索引的搜索关键字是否必须与主关键字相关或与之相关?答案在PostgreSQL和其他DBMS中会有所不同吗?谢谢。

Must the search key of a primary index be or related to a primary key ? Will the answer be different in PostgreSQL and other DBMS? Thanks.

推荐答案

Postgres没有主索引,所有索引都以相同的方式实现,并直接指向数据行。

Postgres doesn't have "primary index", all indexes are implemented the same way, and point directly to the data rows.


主索引的搜索关键字必须是主关键字或与之相关

Must the search key of a primary index be or related to a primary key

它必须是对用于形成主索引的表达式的搜索。
如果主索引被约束为主键上的索引,则否则。 / p>

It must be a search on the expression used to form the primary index. if the primary index is constrained to be an index on the primary key then yes else no.


答案在PostgreSQL和其他DBMS中会有所不同吗?

Will the answer be different in PostgreSQL and other DBMS?

是的,因为postgresql没有主索引。尽管聚簇索引有点像主索引。聚集索引可以是任何表达式上的索引,它根本不需要引用主键。

yes, because postgresql does not have primary index. although a clustered index is a bit like a primary index. the clustered index can be an index on on any expression, it need not reference the primary key at all.

对于postgreql,不需要表具有任何索引。但是,如果要定义表之间的关系,则需要索引。

with postgreql there is no requirement that a table have any index. but if you want to define relations between tables then indexes are required.

这篇关于主索引的搜索键是否必须与主键相关或与之相关?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆