Keep those publish transactions down!

One recurring complaint from Tridion users is the publishing queue. It can be very slow to view it, and sometimes the performance becomes so bad that publishing itself will fail. A symptom of this is that items stay in the queue with the status ‘Waiting for publish’ even though the publisher is running.

Often, all these symptoms have one common cause: the publish transactions table in the database has grown too big. Tridion has no built-in clean-up mechanism for this table, so you have to do some work.

The solution is quite easy: run the Purge Tool regularly. It is installed with the Tridion content manager, so everyone should have it. When you start it, it shows you a window with some options. You can use it to purge old versions of components, pages and other items, to purge workflow histories, as well as purge the publish transactions table.

Of course you can simply run this tool every day, but fortunately there is a command line mode. It is configurable through an XML file (see http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL_Tridion_2011_SPONE/idheading-259253576, login required). Using this XML and a simple bat file you can schedule the purge tool to run every night, and let it remove all publish transactions that are older than say 2 days. You do this with the following XML snippet:

<PublishTransactions Purge="true" Before="2012-09-18" />

There is only one problem with this: the ‘before’ date in the XML must be an absolute date. It would be nicer if SDL would have let us specify a date OFFSET instead, like ‘2 days ago’.

I solved this by writing a simple vbscript that updates the config file and sets the Before date to ‘2 days ago’. My batch file calls this script first, and then the purge tool. The batch file is scheduled to run every night through the Windows task scheduler.

I know many Tridion administrators have come up with this solution, or something similar (better?) already. But since I couldn’t find any of this online, I thought I’d post it here.

Installation instructions:

– Unzip

– Move files to a location of your choice on a Tridion CM server

– Schedule the file RunPurgeTool.bat every night (or as often as you like)

To download: RunPurgeTool.

 

Note: with slight modification, you can use the tool to maintain workflow histories and/or old versions of versionable items.