On investigation and careful monitoring we found that the workflow engine has lots of instances where the workflow was in pending status. We realized that this was a developer issue where the business record was getting approved on the first work item approval on the attached workflow. As a result the user was able to post the data without completing the workflow.
Another issue we found was that there were multiple instances created for the same record this happened as the system dialog for workflow comments was not modal and went in the background and the user was able to submit twice.
Due to the above issues we landed in a situation where we have lots of workflow instance to get rid of and hence this post.
The workflow instance related tables are identified as follows
I have already created a class to save some of the work