Back

BLOG • DIGITAL INSIGHTS

Clean Old Personalization Statistics in Sitefinity

Sitefinity's personalization module can cause the sf_stat_sentence table to grow to millions of records, leading to upgrade issues and page timeouts. This post shares a SQL script to clear old statistics and tips for handling transaction log bloat.

Sitefinity CMS

Sitefinity's personalization module is great for targeting specific customer groups and creating leads, which is why it is widely used. Customer segments are created and content is personalised based on user activity. For the module to work properly it logs user statistical data - and here is the problem that comes with it.

Sitefinity logs these activities in the sf_stat_sentence table, and on a heavily loaded site this can grow very large - 10 million records or more. This has caused issues with upgrades and timeouts on personalised pages.

The Solution

The following SQL script will clear all records older than 3 months (you can adjust the period as needed) and can be set up as a scheduled job:

Notes on Transaction Log

If the sf_stat_sentence table is very large, you may receive an exception that the transaction log is full. To tackle this you need to shrink the log. There are several approaches depending on whether you want to keep your transactions and which SQL Server version you are running.

For SQL Server 2008, if you do not need to preserve transactions, you can run the following script (replace the placeholders with your actual values):

Read More

Explore more insights and case studies from our team.