问题
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