# Sharding policies

Database sharding provides data isolation and can facilitate the management of data growth for improved performance and data maintenance. The Commerce Engine defines sharding policies that determine which global database tables to use for read and write operations when interacting with a Commerce entity or a list.

The Commerce Engine implements database sharding for Commerce entity and list tables, and provides two types of sharding policies. One type is used for operations against Commerce entities (for example, "TableName": "CatalogEntities" ), and the other type is used for read and write operations against lists (for example, "TableName": "CatalogLists").

The PlugIn.SQL.Sharding.PolicySet-1.0.0.json file, located in the C:\inetpub\wwwroot\<CommerceEngineInstance>/wwwroot\data\Environments\ folder, contains Commerce Engine sharding policies.

The CommerceEntities and CommerceLists policies have an “Expressions” property that takes a list of regular expressions for values (for example "^Entity-Catalog.*?$"). The Commerce Engine uses these property values to identify the database table to read from or write to. For operations against a Commerce entity (for example CatalogEntities ), the entity ID that the operation targets is matched against the list of regular expression values. For operations against a Commerce list, for example, IFindEntitiesInListPipeline, the match is based on the list name. The following provides an example of the default database sharding policies for Catalog entities and Catalog lists:  { "$type": "Sitecore.Commerce.Plugin.SQL.EntityShardingPolicy, Sitecore.Commerce.Plugin.SQL",
"Expressions": {
"$type": "System.Collections.Generic.List1[[System.String, mscorlib]], mscorlib", "$values": [
"^Entity-Catalog.*?$", "^Catalog-.*?$",
"^Entity-Category.*?$", "^Category-.*?$",
"^Entity-SellableItem.*?$", "^SellableItem-.*?$"
]
},
"TableName": "CatalogEntities"
},
{
"$type": "Sitecore.Commerce.Plugin.SQL.ListShardingPolicy, Sitecore.Commerce.Plugin.SQL", "Expressions": { "$type": "System.Collections.Generic.List1[[System.String, mscorlib]], mscorlib",
"$values": [ "^List-CatalogItems.*?$",
"^List-Catalogs.*?$", "^List-Categories.*?$",
"^List-SellableItems.*?$", "^List-Categories.*?$",
"^List-SellableItems.*?$", "^List-PurgeCatalogs.*?$",
"^List-PurgeCategories.*?$", "Entity-Catalog.*?$",
"Entity-Category.*?$", "Entity-SellableItem.*?$"
]
},
"TableName": "CatalogLists"
}