We have commerce in place for one of our project. On dev and UAT environment, commerce db file keep on drastically increased in every 3 months. i.e. 500GB in every 3rd month. I don't think, it is a expected behavior but would like to know if someone else had faced similar kind of issue earlier or any proper solution for this problem.
-
What tables are growing?– Michael WestCommented Aug 13, 2022 at 3:59
-
I haven't gone into table level but entire commerce db size is being increased by 500GB in every 2-3 months.– Arvind GehlotCommented Aug 13, 2022 at 5:49
-
You need to know which table is increasing in size in order to diagnose the issue. Most likely it will be the blob table, as that is where the largest data is stored. Have you tried running the cleanup DB command from control panel? This will remove orphaned blobs.– Dean OBrienCommented Aug 13, 2022 at 11:14
-
If it is the blobs table and the cleanup doesn't work, then you might try something like this sitecore.stackexchange.com/a/20505/95– Michael WestCommented Aug 13, 2022 at 13:26
-
Thanks @DeanOBrien and Mochael West. I will try update.– Arvind GehlotCommented Aug 14, 2022 at 7:02
1 Answer
When we specifically check which table is having a huge amount of records and data, we got to know that it was the CommerceEntities.
CommerceEntities table can keep growing with the product changes - a new version is added for each product updates. And that is because journaling is enabled for those entities.
This feature can cause rapid DB size growth. We can simply disable this journling feature by removing relevant configuration from environment config file like..
wwwroot\CommerceAuthoring_Sc\wwwroot\data\EnvironmentsPlugIn.Habitat.CommerceAuthoring-*.*.*.json
Just remove this section wherever you find. This will disable journling. However, disabling this will not remove existing records from the table. It will just not add new records whenever entity is updated in future.
"$type": "Sitecore.Commerce.Plugin.Journaling.EntityJournalingPolicy, Sitecore.Commerce.Plugin.Journaling",
"EntityFullName": "Sitecore.Commerce.Plugin.Customers.Customer",
"Journal": "CustomersJournal"
You can find more detailed information on this topic here.
https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-commerce/entity-journaling.html