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

查看:643
本文介绍了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?

这意味着,如果我添加一个<$ c在文本列上的$ c> UNIQUE 约束,该文本列现在有索引还是必须单独添加索引? p>

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中的btree索引实现的。

Yes. UNIQUE constraints are implemented using a btree index in Postgres.

详细信息:

  • How does PostgreSQL enforce the UNIQUE constraint / what type of index does it use?

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

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