What is a good way to delete a stuck batch in Drupal 7?

It is on a production server, we are using the Background Batch module so it shows us which one it is at admin/config/system/batch/overview.enter image description here

I know I can just run a query and delete that row from the DB but wondering about other cleanup I should do too.

2 Answers 2


Another approach (if you don't want to run sql-statements directly) would be Queue UI:

  • View queues and number of items
  • Developers can define meta info about queues they create and process
  • Process queue with Batch API
  • Process queue during cron
  • Remove leases
  • Delete queue

enter image description here

  • Thanks, was looking for something quick and easy to run on a production server without committing new code. Does this delete batches though or just queues? Jun 24, 2016 at 17:33
  • 1
    batches are treated as queues, so yes. Jun 28, 2016 at 16:14
  • 4 years later, I just accepted this answer! I remember now that this worked well for that project, thanks again! Aug 26, 2020 at 14:54

In my case the batch ID is 5166:

DELETE FROM batch WHERE bid IN (5166);

In our case we are using Better Batch and we also needed to run:

DELETE FROM better_batch WHERE bid IN (5166); otherwise we received an infinite redirect message in Chrome "too many redirects".

source: https://www.drupal.org/node/1627850#comment-6142774

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.