postgresqlora2pg

Oracle Primary Key to Postgres


I'm migrating tables from Oracle to Postgres.

When a Primary key is created on an Oracle table, it implicitly creates a unique index with the same name. But there is no such index created in Postgres or it is not visible in data dictionary tables.

Postgres doesn't allow creating an index with the Primary key name. I want to know if a unique index is required in Postgres on the primary key column. Does it by any way alter query performance if I do not create unique index for primary key column? Thanks in advance.


Solution

  • That is not correct:

    create table pk_test (id integer primary key);
    
     \d pk_test
                  Table "public.pk_test"
     Column |  Type   | Collation | Nullable | Default 
    --------+---------+-----------+----------+---------
     id     | integer |           | not null | 
    Indexes:
        "pk_test_pkey" PRIMARY KEY, btree (id)