On 05/29/07 17:46, Michael Glaesemann wrote:
On May 29, 2007, at 15:28 , John D. Burger wrote:
Even ISO country codes are not guaranteed to be stable
I'm not sure where the idea that primary keys must be stable comes from.
There's nothing necessarily wrong with updating a primary key. All a
primary key does is uniquely identify a row in a table. If that id
changes over time, that's fine, as long as the primary key columns
continue to uniquely identify each row in the table.
And any archived data (for example, transaction detail that you must
keep for 7 years but don't still want in your database, since it
doubles your backup/restore times) will still have the old codes.
"Static" data needs to be static.
SQL even provides
ON UPDATE CASCADE to make this convenient. There may be performance
arguments against updating a primary key (as the changes need to
propagate), but that depends on the needs of a particular (benchmarked
and tested) application environment.
--
Ron Johnson, Jr.
Jefferson LA USA
Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend