Search code examples
postgresqldatabase-designindexingconstraintsunique-constraint

Does a Postgres UNIQUE constraint imply an index?


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?


Solution

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

    See: