A table can have one and only one primary key. It is a good practice to add a primary key to every table. The index covers the columns that make up the primary key or unique constraint (a multicolumn index , if appropriate), and is the mechanism that enforces the constraint.
Declaring field(s) as the primary key automatically adds a UNIQUE constraint on those fields. Postgres and Indexes on Foreign Keys and. If I have a primary key constraint defined in the database do I also need to create an index on that field for fast lookup?
The documentation on the web seems to imply that the contraint is not an index. What the difference between creating a unique, not null index and setting a primary key ? I would just drop the existing index and create the primary key using the columns you specified. Bloat in primary key indexes has been a long standing issue (although not faced by many), and especially since online rebuild of primary keys was never possible in production environments. Verified the two tables relations and check the data on those table. If you required take table dump backup of these two tables.
So it can be said that the PRIMARY KEY of a table is a combination of NOT NULL and UNIQUE constraint. Is there a fundamental difference between a primary key and a unique index ?