In this tutorial, you will learn about the steps you can follow to ensure your Umbraco database stays healthy. The main table within a Umbraco database that is known for causing issues is the audit table. If you want to ensure your Umbraco web pages and site performance is not impacted because of an unhealthy database, read on 🔥🔥🔥

Providing auditing capabilities within a CMS can be an invaluable capability for a lot of companies. Being able to know when a content editor logged into the CMS, what content an editor created and when can be important. For some companies, this might be a legal requirement. , Within Umbraco, auditing data is stored within the database. The problem with audit data is that after a period of time, the amount of data stored can become very large. When a table becomes too large, queries to the database can be negatively impacted. When this happens your web page performance can be impacted. I've seen pages take 10 to 20 seconds to load when a database is unhealthy

To ensure your Umbraco website works quickly, you should schedule regular time to prune the audit table. Clearing out your log files is relatively painless and can be done in several ways:

SQL Truncate: The main way to do anything within a database is to write some SQL. The table you need to clear is the umbracoLog table. In SQL, a TRUNCATE command is a lot faster than a DELETE command. For reference, DELETE commands are logged in the SQL transaction log. A large log file is another cause for slow performance issues! To clear the audit log, I recommend using this command:

Your log table should hopefully be empty 💥

SQL Shrink:

If that command doesn't work, as an alternative you can squish your SQL logs instead. To do that, open SQL Manager, right-click on your and database select:

TasksShrinkFiles

Within Shrink File change the file type to Log and click on OK. Job done 💥


Although the advice in this article is quite simple, it can really help speed up your site and boost performance. Failing to follow this advice can result in bad things happening, so be warned 😊. Happy Coding 🤘