开发者

Drop primary key index

Can I drop primary key i开发者_运维百科ndex without dropping primary key constraint in postgresql?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜