views:

63

answers:

2

Can I drop primary key index without dropping primary key constraint in postgresql?

+2  A: 

Your question is a bit confusing. I think you must mean this:

Can I drop an index on a column but still keep the uniqueness constraint on that column?

No. A uniqueness constraint requires an index. You can make your constraint into an ordinary non-primary index, but you can't make it not an index.

Also, read about primary keys in the documentation:

Technically, a primary key constraint is simply a combination of a unique constraint and a not-null constraint.

So if a column is a primary key it has by definition a unique constraint and therefore also an index. You cannot have a primary key that isn't an index.

Mark Byers
A: 

Thank you Mark.

Ruwani