Quantcast
Channel: Active questions tagged surrogate-key - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 31

How not to "naturalize" surrogate keys?

$
0
0

Don't naturalize surrogate keys. As soon as you display the value of a surrogate key to your end users, or worse yet allow them to work with the value (perhaps to search), you have effectively given the key business meaning. This in effect naturalizes the key and thereby negates some of the advantages of surrogate keys.

http://www.agiledata.org/essays/keys.html

Don’t “naturalize” surrogate keys. As soon as you display the value of a surrogate key to your end users, or worse yet allow users to work with the value (perhaps via search), you have effectively given the key business meaning. The exposed key in our database could then be considered a natural key in someone else’s.

https://begriffs.com/posts/2018-01-01-sql-keys-in-depth.html

And yet, every web framework/ORM I am familiar with (e.g. Ruby on Rails) exposes the surrogate key in the URL which is natural key that users share, send, save, bookmark, etc.

In light this of this recommendation, what are the best practices for handling web URLs?


Viewing all articles
Browse latest Browse all 31

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>