| From: | Thomas Poty <thomas(dot)poty(at)gmail(dot)com> | 
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org | 
| Subject: | primary key and unique index | 
| Date: | 2018-03-23 07:55:35 | 
| Message-ID: | CAN_ctnhdQAe3n7NgCvHUTAb1MQzZnHoNjDSPwNThWk_b9N4wZQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hi all,
I am migrating fromMySQL to Postgresql 9.6.
In MySQL a  "show create table" gives me :
 ...
  PRIMARY KEY (`ID`,`CountryCode`,`LanguageCode`),
  UNIQUE KEY `unique_my table_4` (`ID`,`CountryCode`,`LanguageCode`),
...
So, In PostgreSQL, does it make sense to create a primary key AND a unique
index based on the same columns?
Is PostgreSQL smart enough to use the unique index created for the primary
key.
I know PostgreSQL can be based on a unique index to create a primary key
but I also know it is possible to create several indexes on the same
columns with the same order.
Thanks
Thomas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2018-03-23 08:10:40 | Re: primary key and unique index | 
| Previous Message | Tom Lane | 2018-03-23 04:59:24 | Re: FDW Foreign Table Access: strange LOG message |