Updating history removal datetime through database

I need to update the removal time of a lot of records (millions) and I also have a criteria on which to update so I want to do this through the database instead of using the API. What tables and columns do I need to update so that all history related to the process, including variables is deleted?

My workflows only contain service tasks (java delegate) and decision files. I saw the following tables all have their own removal time column, do I need to update all of these? am I missing any table related to history?

  • ACT_HI_VARINST
  • ACT_HI_DECINST
  • ACT_HI_DEC_IN
  • ACT_HI_DETAIL
  • ACT_HI_ACTINST
  • ACT_GE_BYTEARRAY