Is it desirable to store some information (metadata) about the content in the Id (or key) of this content?
In other words, I use time-based UUIDs as identifiers (or keys) for some content stored in the database. My application first accesses the list of all such identifiers (or keys) of the content (from the database), and then refers to the corresponding content (from the database). These identifiers are actually UUIDs (time). My idea is to store additional information about the contents in the identifiers themselves so that my software can access this meta-content without having to access all the contents from the database again.
My application context is a website using Java technology and a Cassandra database. So my question is:
should i do this? I am worried that it may take a lot of processing (while presenting data to the user) to get metadata from the content identifiers! Thus, instead it is better to get it from the database, and then get through the processing of the identifier of this content.
If offered, how should I implement this effectively? I thought of the following: -
Id of a content = 'Timebased UUID' + 'UserId'
where 'timebasedUUID' is the generated identifier based on the timestamp when this content was added by the user, and 'userId' represents the identifier of the user who posted this content.
so my example Id would look something like this: - e4c0b9c0-a633-15a0-ac78-001b38952a49 (TimeUUID) -- ff7405dacd2b (UserId)
How can I extract this userId from the above content identifier in the most efficient way?
Is there a better way to store meta information in identifiers?
source share