OSTicket database shrink

1st of all please do all this on your own risk, i will just tell my story without any warranty or responsability

Recently i was asked to help with an osticket database which was about 3GB and sometimes was experiencing slow loading

what i did?

  1. BACKUP 🙂
  2. opened phpmyadmin , select database then click Search tab
  3. wrote a term in the search box which was used in the tickets ( examples: skype, dropbox ) and which is very unlikely to appear in osticket database structure / content
  4. i found out that tables ost_file ( + ost_file_chunk), ost_thread_entry, ost_thread_entry_mail, ost_ticket_data
  5. i have deleted in ost file records many years behind, then write down what was the lowest id value remaining in the table
  6. i have deleted all the rows in ost_file_chunk associated with the deleted id at point 5

    ..at this point you will have a big decrease of space used (my case recalculated over night – either ost maintainance operation either cpanel optimization )
  7. you want also to delete ticket history? i went to ost_thread_entry delete all tickets with date lower than a specific date
  8. i deleted also close to 10k rows in ost_thread_entry_mail

    ..since this operation is done onece every 5/10 years i didnt put in a script …
    So far, the installation works flawless!