I have celery periodic task that need to run postgres VACUUM query after each run, otherwise this task eats a lot of HDD space.
I tried to run VACUUM inside task at the end, but got error:
DatabaseError: VACUUM cannot run inside a transaction block
I tried to apply @transaction.commit_manually
decorator and do transaction.commit()
before calling VACUUM, but got this error:
TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
Is there way to do VACUUM inside celery task? Or somehow disable for task transaction logic?