This is likely because there is too much data to perform the trim and the SQL query is failing or timing out. This often happens when you have View auditing enabled and frequent site usage.
I would recommend opening a case with Microsoft. They can provide guidance and more importantly, leave you in a supported state while manually trimming the table via SQL queries. If you trim the SQL table yourself, your farm will enter an unsupported state.