Search code examples
sitecoresitecore7

Sitecore - delete bucket subitems


I have items importer which deletes all item subitems and creates new subitems. Recently I switched it to buckets and now I have a problem with deleting. I delete items using:

myItem.DeleteChildren();

Without bucket it took about 20min. Now it takes about 1h for 5k items. Do I need to revert bucket item before deleting and then synchronize again? What is the quickest way to delete bucketable items?


Solution

  • You could take it a step further. I was able to import 30k in minutes by disabling all three.

    using (new Sitecore.SecurityModel.SecurityDisabler())
    {
        using (new Sitecore.Data.Events.EventDisabler())
        {
            using (new ProxyDisabler())
            {
                //delete code here
            }
        }
    }