Does a Postgres UNIQUE constraint imply an index?

岁酱吖の 提交于 2019-12-28 04:31:07

问题


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

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?


回答1:


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

Details:

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


来源:https://stackoverflow.com/questions/29655439/does-a-postgres-unique-constraint-imply-an-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!