When viewing the workbox for a client install i can see a lot of workflow activity stretching back years. This is not needed now and was wondering whether there is a way to delete all workflow history over a year old. Can i just delete the items in the workflowhistorytable or is there a better way to do it?
2 Answers
Run this SQL query on your master DB:
DELETE FROM [dbo].[WorkflowHistory] WHERE [Date] < '2017-03-01' -- put required date
You can definitely delete data, but since you asked "is there a better way to do it" I would recommend looking at building something that would run as a task in the initialization pipeline or on a regular cadence that would do this regularly for you, otherwise you will have to manually do this for all your environments on a regular cadence.
You probably want it to be configurable as to how long to retain data so that you can keep data longer in your test systems (which are less active) and have shorter spans in production.