Drupal - Delete 13000 nodes

VBO is the de facto standard for bulk-deleting nodes, there simply isn't a better way to do it.

As VBO processes in batches it only does 1 (or maybe a couple) of nodes at a time. So if you're receiving timeout errors those are related to the deletion of a single node, not to the entire batch operation.

The standard resolution to something like this is to increase the PHP max execution time to compensate.


Install Devel. Then go to admin/config/development/generate/content in D7 and select all content type. Check "Delete All content". Enter 0 in "How many nodes would you like to generate? "

Click Generate.

That'll delete all nodes.


Use a VBO and execute it from Drush. I used the following method to delete over 1.5million nodes after scale testing.

  1. Create a new view with a page. Set the filters appropriately to display only the type of nodes you'd like to delete.
  2. Add a new field: "Bulk operations: Content"
  3. Check the box next to "Delete item" under 'Selected bulk operations'.
  4. Save the view.
  5. Assuming you know how to use Drush, run this command: (Use a linux 'screen' to run uninterrupted for big datasets)

drush vbo-execute my_view action::views_bulk_operations_delete_item

Where, my_view is the machine name of your view

You can also use drush vbo-list to display all available views and their bulk operations.

The VBO should now run in the shell, giving you feedback as it goes.

Tags:

Nodes