Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have about 13000 nodes to delete in my drupal 7. I have tried 'views bulk operations' to delete 500 nodes at a time but its showing "Request Timed out". I am able to delete only 50 nodes at a time through admin successfully, if more than 50 it shows "request times out".

Can some one help me on this so that i can delete huge number of nodes at a time.

Thanks, Chaithanya

share|improve this question
There used to be "bulk delete" module, but got obsolete in favor of VBO anwyay. But VBO seems to support batch processing. Have you tried to use it? – Mołot Jun 14 at 9:36
1  
VBO, as indicated in the answers below, is probably the way to go. What I've done at times of needing to delete a magnitude more nodes than in this case, is hack module invoke to ignore lots of hooks invocations that I don't need. (My worst offender was apache solr). This can significantly speed up the work, but obviously must be done with great care. – Letharion Jun 14 at 9:54

5 Answers

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.

share|improve this answer
1  
Just to complete the answer: You can choose how many entities should be picked up for the operation. Using 100 will do fine in ~1 minute from my experience. – Ayesh K Jun 14 at 19:29

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.

share|improve this answer
1  
@Mołot 'Check "Delete All content"'... 'Enter 0 in "How many nodes would you like to generate? "' ...;) – Clive Jun 14 at 9:40
@Clive OK, my mistake, sorry. – Mołot Jun 14 at 9:42
Specifically, it's the Devel Generate module that does this; it ships with Devel, but you won't get this functionality if you just enable Devel. You can also easily delete all nodes of a certain content type this way, if you don't want to delete everything. If you're still getting PHP timeouts and aren't afraid of the CLI, you can also use the Drush generate-content (genc) command that comes with Devel Generate; drush help genc for usage info. – Garrett Albright Jun 14 at 15:00

There is a Delete All module out there. It will delete all the nodes and/or users from the site.

It also has Drush support:

Examples:

drush delete-all article             Delect all article nodes.  
drush delete-all all                 Delete nodes of all types.  
drush delete-all --reset             Delete nodes of all types, and reset node, revision and comment counters.  
drush delete-all users               Delete users.
share|improve this answer
2  
I'd strongly recommend not using this module - it sets a time limit of 30 seconds on the script, and runs through each and every node individually, calling node_delete() (it doesn't even bother to use node_delete_multiple()). Even more worryingly, it has an option that deletes data directly from the database tables without using the field API, and without using hooks. No batch jobs at all, it just runs until the script dies. Very dangerous module IMHO. – Clive Jun 14 at 9:45
1  
Could still be useful if you know what you're doing, and take backups. Deleting thousands of nodes while invoking all hooks and apis can be painfully slow. :( – Letharion Jun 14 at 9:51
@Letharion No pain, no gain ;) You're right of course, I though I'd just better slap a disclaimer on this as this module could make things messy if in the wrong hands! – Clive Jun 14 at 9:53
@Clive With drush support if I get to do drush delete-all article to delete articles I'd go for this solution. – develkar Jun 14 at 10:24
@develkar For a few hundred nodes that might be fine, but the drush extension uses exactly the same functions as the on-site version so it's still just as susceptible to timeouts unfortunately – Clive Jun 14 at 10:30

Use Views Bulk Operations - it was a good idea. But instead of calling operation directly, use batch api. Here you can read shor article about it. Lack of documentation on that part was a known problem.

share|improve this answer

For deleting nodes in large number(i.e is bulk) like in your case, you could also use Bulk delete module for this.

That will use the Batch API to delete the nodes to avoid timeout or memory issues when deleting thousands of nodes with a single call to node_delete_multiple().

Apart from this,you can even try Delete all module for deleting all the nodes of a content type.

Hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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