Skip to main content
edited title
Link
mustaccio
  • 28.8k
  • 24
  • 60
  • 77

Large table with single column Why can't three non-unique indexes andbe used to enforce a multi-column unique constraint?

Source Link
Anvil
  • 11
  • 3

Large table with single column indexes and a multi-column unique constraint

I have a large PostgreSQL table of 3 columns, I created a separate btree index on every single column. Then, I created a multicolumn unique constraint on the table on all the 3 columns, expecting the constraint not to create any index since they're all already btree indexed, the result is the opposite and even worst, it generated a constraint object size that is larger than all the 3 indexes combined. I'd like to understand more if someone is willing to shed some light on this behavior.