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
  • 605,456
  • 145
  • 1,078
  • 1,228
hooknc
  • 4,854
  • 5
  • 31
  • 60

1 Answers1

12

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

See:

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228