Is sys_contentid unique?

sys_contentid seems to be a unique id but I can’t find anything definitive. Can anyone verify that sys_contentid is a unique id?

Yes, it is unique to that content item.

okay, so to make a content item unique system wide you need to include the content type as well.

No, that’s not what I said.

The content id is unique for that item. If there are multiple revisions, all of them have the same content id.


hmm, let me rephrase the question.

If you publish out a bunch of different content items with different content types (article, faq, etc) to a database can use sys_contentId as unique id or are there going to be duplicates ids?

In other words what makes a primary key for a content item?

Is it sys_contentId? We don’t need to worry about revisionId because it is in the publish state, correct?

Or, is it sys_contentId + contentType?

Or, is it something completely different?

Every content item has exactly one content type. That is, a content item is either an Article or an FAQ, it’s never both content types at once.

Now, it is possible to publish the same item multiple times using different templates, and of course this would result in the same content id. It’s also possible to publish the same content id multiple times in a different “context”. This can also result in duplicate published rows with the same content id.

However, neither of these cases is common: usually, there is only 1 publishing context and only 1 database publishing template per content item. In this case, it is safe to use the content id as the primary key.

The principal problem with using the content id as primary key is not “duplicates”, it’s handling updates. In some cases, you may want to substitute one item for another (you make a new home page and you want it on the site). If you use the content id as the primary key, the new home page will always have a different ID, and you cannot fool the system into think that it goes in the “same place” as the original home page.

Of course, there are more sophisticated strategies for dealing with this problem, but let’s establish exactly what your requirements are before we tackle that issue.


Let’s word it differently.

If we publish multiple content types to the same table with the following columns:


Is sys_contentId unique across all content types? Or do we need to include an additional column to make it unique, i.e. a contentType column?

Ok, I give up.

Let’s keep this real simple:

NO, the Content Id is not unique in all cases.

NO, the Content Type ID is not required.

To make the row truly unique you must also add the Site Id, the Context and the Template Id. Of course, these values are NOT COLUMNS, they are derived values determined during publishing.

If you want more details, go back and re-read the previous posts. I’ve explained it as well as I can.