Global Database IDs

By Deane Barker 1 min read
AI Summary

This post explores the concept of global database identifiers, discussing their importance in managing unique data across distributed systems. The author highlights challenges, best practices, and potential solutions for ensuring data integrity and consistency in global databases.

Here’s a handy feature for a database…

Tables can have primary keys, but what about a database-wide primary key? When a row is inserted, the “id” field would be populated with a numeric key that’s unique to the entire database, not just that table.

Additionally, a two-column system table would store (1) all the keys in the database, and (2) the table each key is in. So, with just a number, you could pull a record out of anywhere in the database, without even knowing exactly what it is.

Better yet, give me SQL syntax like this:

SELECT * WHERE global_id IS [number]

Or even just:

SELECT [number]

Since I don’t know what type of object it is, I don’t know the fields, so I can’t request them explicitly anyway.

The table name could be given back to me in a system field. Then my code could read that field, figure out what type of object it is, and load it up from the data in the record.

I know, I know – you could do this manually using triggers and a stored procedure or two. But what a pain. This should be supported natively.

Someone call Larry Ellison. I want royalties.

Links to this – The Envelope Pattern of Content Management August 4, 2005
CMS don't need to have an intimate knowledge of the content they're managing. Rather, they just need to know that they're managing content in general, and leave the specifics to the implementation.