jeudi 5 mars 2015

Table with both primary key and unique key


My system requirement defines a unique business/domain/natural key (i.e. <yyyymmdd><branch_id><running_number>, in bigint). Should I use this unique key as primary key or I should still create an extra sequential primary key? My table is operation table and not warehouse table.


Someone with SQL Server experience advice me to have both sequential primary key and a unique business key due to performance hit with clustered index at growth of data. However, I am using PostgreSQL 9.3.



  1. Should I just make the unique business key as primary key, which simplify my backend application coding as I am using ORM (Hibernate)?

  2. What benefit I can gain if I have both sequential primary key and a unique business key?





Aucun commentaire:

Enregistrer un commentaire