When and How to Clean the Event Queue and Properties Tables
Sitecore is a .NET application that leverages relational database storage in the management of its operations. These operations could be scheduled jobs, xDB or xConnect Processing, OnPublish/OnEnd events, or manually triggered events. The Event Queue Table in the Core, Master, and Web databases store this data depending on which events the database is associated with.
It also stores referential information about the environment, such as server names. The Properties Tables in the Core, Master, and Web databases store this data.
When and How to Clean the Event Queue
When all is working well, events come in and are processed appropriately, but there are times when you may need to clear the Event Queue. A few examples are:
- You have stuck events that prevent further processing, such as a large or failed publishing operation that has the queue “stuck”
- You have upgraded Sitecore and the Event Queue is not processing
- You have migrated from another environment, or deployed databases to Azure SQL from an on premises source (thus it contains data not relevant to its new environment)
In these instances, you can clean the Event Queue Table in the desired database by running the following SQL. Ensure that you have selected the database you want to run it on (Core, Master or Web):
SELECT 1
WHILE @@ROWCOUNT > 0
BEGIN
DELETE TOP (1000)
FROM eventqueue
END
GUI Option
For those who don’t want to use SQL, there is an admin page for clearing the Event Queues and managing retention periods located at: /sitecore/admin/EventQueueStats.aspx
When and How to Clean the Properties Table
As previously stated, the Properties Table stores data about the Sitecore environment. There may be a few scenarios in which you need to clear artifacts out of this table in the Core, Master, or Web databases. This includes and is not limited to:
- Migrating from another environment to new servers
- Deploying to Azure SQL from an On Premises build using .bacpac files (again, different servers)
- Changes to your existing environment such as removal of unneeded Content Delivery Servers
In these instances, use the following SQL to remove the no longer associated servers from the Properties Table of the desired Core, Master, or Web databases. Note that you need to determine what Key to search for. As an example, if you have Servers in your environment you migrated from and they are named “OldServers”, these would be in the Properties Table of the new environment until you remove them.
DELETE FROM Properties WHERE [Key] LIKE '%OldServers%'