There is a table called IDTable that comes by default with Sitecore installations.
What is the usage of this table ?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.Sign up to join this community
The Sitecore 6.6 scaling guide has this to say about the
You can store persistent mappings of arbitrary keys to Sitecore IDs in the Sitecore
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
IDTablein the web.config file in the
IDTablesection in the
<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
IDTablebetween the CM and CD environments, change the
connectionStringNameparameter in the
IDTableconfiguration 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.