7

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?

Erwin Brandstetter
  • 539,169
  • 125
  • 977
  • 1,137
hooknc
  • 4,540
  • 5
  • 32
  • 55

1 Answers1

12

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

See:

Erwin Brandstetter
  • 539,169
  • 125
  • 977
  • 1,137