Re: Enforce primary key on every table during dev?

From: Rakesh Kumar <rakeshkumar464(at)aol(dot)com>
To: haramrae(at)gmail(dot)com, melvin6925(at)gmail(dot)com
Cc: theophilusx(at)gmail(dot)com, finzelj(at)gmail(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Enforce primary key on every table during dev?
Date: 2018-03-01 12:07:47
Message-ID: 161e1761560-58a6-18e4b@webjas-vad211.srv.aolmail.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>Adding a surrogate key to such a table just adds overhead, although that could be useful
>in case specific rows need updating or deleting without also modifying the other rows with
>that same data - normally, only insertions and selections happen on such tables though,
>and updates or deletes are absolutely forbidden - corrections happen by inserting rows with
>an opposite transaction.

I routinely add surrogate keys like serial col to a table already having a nice candidate keys
to make it easy to join tables. SQL starts looking ungainly when you have a 3 col primary
key and need to join it with child tables.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kiran Krishnamachari 2018-03-01 14:06:38 Custom ranking function for full text search
Previous Message Ron Johnson 2018-03-01 10:24:45 Version upgrade: is restoring the postgres database needed?