Postgres UNIQUE 约束是否意味着索引? [英] Does a Postgres UNIQUE constraint imply an index?

查看:48
本文介绍了Postgres UNIQUE 约束是否意味着索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向 Postgres 表添加唯一约束是否意味着也向该表添加了索引?

When adding a unique constraint to a Postgres table does that imply that an index has also been added to that table?

意思是,如果我在 text 列上添加 UNIQUE 约束,那么该文本列现在有索引还是必须单独添加索引?

Meaning, if I add a UNIQUE constraint on a text column, does that text column now have an index or does an index have to be added separately?

推荐答案

是.
UNIQUE 约束是使用 Postgres 中唯一的 B 树索引实现的.

Yes.
UNIQUE constraints are implemented using a unique B-tree index in Postgres.

见:

这篇关于Postgres UNIQUE 约束是否意味着索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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