Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Architecture design for full stack development.

by chacham (Prior)
on Jun 24, 2017 at 19:27 UTC ( #1193460=note: print w/replies, xml ) Need Help??


in reply to Re: Architecture design for full stack development.
in thread Architecture design for full stack development.

Primary Key values should always be arbitrary.

No, they should not. In an ideal world, the Primary Key is the unique identifier that inherently denotes the current record. Using arbitrary values is a kludge by people who simply do not understand how a database works.

the primary key values themselves should never be visible outside of the database: if the business needs unique identifiers, you should coin your own, e.g. with UUIDs. Never attempt to re-use PK values, or for that matter, business-known identifiers. In keeping with the principles of database normal-forms, all keys should be nothing other than abstract identifiers, carrying no embedded information.

That is ridiculous. There is nothing wrong with reusing PK values. And it has nothing to do with normal forms.

  • Comment on Re^2: Architecture design for full stack development.

Replies are listed 'Best First'.
Re^3: Architecture design for full stack development.
by jahero (Pilgrim) on Jun 26, 2017 at 10:37 UTC
    Hello, I would strongly disagree with the last statement, that is is OK to reuse value of a primary key. Such approach invalidates any attempt to compare previous state and current state of a record in a table (since meaning of the id value is changed). Of course, this sentiment is probably irrelevant to the problem you are trying to solve...

      Such approach invalidates any attempt to compare previous state and current state of a record in a table

      If a previous value has meaning, it should never have been deleted. Also, in most schemes, PK re-use come some time after its original use.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1193460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2021-01-27 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?