There is a table called IDTable that comes by default with Sitecore installations.
What is the usage of this table ?
The Sitecore 6.6 scaling guide has this to say about the IDTable
:
You can store persistent mappings of arbitrary keys to Sitecore IDs in the Sitecore
IDTable
.By default, this is only used by the Sitecore CMS WebDAV functionality to keep locks on media items in the CM environment and does not need to be synchronized with the CD environment.
You configure the location of the
IDTable
in the web.config file in theIDTable
section in theconnectionStringName
parameter:<IDTable type="Sitecore.Data.$(database).$(database)IDTable, Sitecore.Kernel" singleInstance="true"> <param connectionStringName="master" /> <param desc="cacheSize">500KB</param> </IDTable>
To synchronize the contents of the
IDTable
between the CM and CD environments, change theconnectionStringName
parameter in theIDTable
configuration section to point to a Core database that is shared or replicated between the environments. Alternatively, it can point to a shared Web database.
There is also this page documenting the table and its API in more detail:
So you can use this table to map any string key to an ID. An example scenario would be importing items from an external system and tracking the imported item IDs to avoid duplicates.
The IDTable is used to store persistant mappings of external keys to Sitecore IDs. Be aware though, that IDtable lookups requires an additional query to the database (caching aside), and may impact performance.
There are alternatives to using the IDTable, for example Sitecore Commerce Connect takes a different approach, by generating deterministic GUIDs from the external key. From the Commerce Connect Integration Guide:
3.1.5 ID Mapping By design, the remote product repository is always regarded as the main repository, which by default owns the products.
That makes the ID of the products and artifacts in the external system the primary key.
In Sitecore, the IDs of the corresponding items for products and artifacts are generated by Connect instead of relying on the default Sitecore implementation that automatically generates a new GUID for each new item created.
By using a hash algorithm, it is possible to generate a direct mapping between the IDs coming from the external system and the item IDs in Sitecore. It has the following benefits:
- No need for mapping tables taking up space.
- It becomes very fast to get the ID of the corresponding item.
- There is no need for searching for the items in Sitecore if the external ID is provided.
The default implementation is based on the MD5 hash algorithm and has the following format:
Item.ID = MD5.ComputeHash(Prefix + ExternalID);
So instead of storing mappings in the IDTable, create predictable consistent IDs, based on the external key.