I have a simple function that loops through and deletes nodes of a certain type. These nodes are custom CCK content types that also behave as categories. The content type isn't very complex... about 5 fields.

Here is my function:


function _delete_cities_submit() {
	
	$query = "select nid from node where type='content-city'";
	$results = db_query($query);
  while ($node = db_fetch_object($results)) {
  	node_delete($node->nid);
  	$output .= "deleted node " . $node->nid;
  }
  
  drupal_set_message($output);
	
}

The problem is that this function takes about 10 minutes to delete 300 nodes!!

Comments

JirkaRybka’s picture

Status: Active » Closed (fixed)

IMO it's entirely possible that processing hundreds of nodes is a bit slow. Normally, you would delete just single nodes, mostly, so this is quite minor, if a bug at all.

Otherwise, 4.7.x is not supported anymore, and there's 2.5 years silence, so closing now. If you've a similar problem on 6.x, I suggest using Batch API.