# Deleting 40K topics

**URL:** https://meta.discourse.org/t/deleting-40k-topics/98781
**Category:** Support
**Created:** [October 5, 2018, 6:39am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781 "2018-10-05T06:39:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gerald](https://avatars.discourse-cdn.com/v4/letter/g/ea666f/32.png) [@gerald](https://meta.discourse.org/u/gerald)
#### Post date: [October 5, 2018, 6:39am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781/1 "2018-10-05T06:39:00Z")

</div>

Hi,

I am trying to delete ~40,000 topics from discourse. The method I use is programming a browser macro service [https://chrome.google.com/webstore/detail/kantu-browser-automation/gcbalfbdmfieckjlnblleoemohcganoc](https://chrome.google.com/webstore/detail/kantu-browser-automation/gcbalfbdmfieckjlnblleoemohcganoc) to go to a specific search page in my Discourse site, click on ![image](https://global.discourse-cdn.com/meta/original/3X/9/0/9033aa302293c14e7e6bbd3d4f7a5ab6a2e3aeb9.png) then select all and click on ![image](https://global.discourse-cdn.com/meta/original/3X/c/0/c0b50f950b241d8d3c856fa8e27a9bf8a0ac262e.png) and click on the red delete-topics button.  
I play this macro in a loop so it deletes 50 posts at a time, but after a few cycles, the site crashes.

Is there a better method?  
Why is deleting posts such a heavy task for the server?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 5, 2018, 6:43am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781/2 "2018-10-05T06:43:19Z")

</div>

How did you get into a situation where you need to delete 40,000 topics? Why are these topics there?

At any rate, you should be deleting them from the command line, browser automation isn’t a good way to approach this.

---

<div class="post-metadata">

### Author: ![gerald](https://avatars.discourse-cdn.com/v4/letter/g/ea666f/32.png) [@gerald](https://meta.discourse.org/u/gerald)
#### Post date: [October 5, 2018, 8:18am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781/3 "2018-10-05T08:18:32Z")

</div>

They were created by a script that publishes wordpress posts that creates a matching discourse topic for every wordpress post.

Unfortunately I don’t have the knowledge how to do this in the command line, but I still think that the batch delete can be improved. For example, it lets you choose up to 1000 topics to edit/delete but it can’t handle such a task, perhaps because it tries to do them all at once. Maybe there is a way to do this more sequentially so the server can handle the load. If I could delete 1000 posts at a time, i wouldn’t have a problem doing it manually via the browser, only 40 time for 40K topics.

EDIT: I increased the server power (to 4 cpus, 4GB ram) and restarted the browser automation and it deleted everything within a couple of hours… so in case anyone reads this in the future, it is something you can do if you don’t have command line experience..

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 5, 2018, 10:59am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781/4 "2018-10-05T10:59:14Z")

</div>

Can you not restore from a recent backup?

You might search here for ‘rails delete post’ or, if you have a budget, ask for help in #Marketplace.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 4, 2018, 11:09am UTC](https://meta.discourse.org/t/deleting-40k-topics/98781/5 "2018-11-04T11:09:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
