How do i permanently remove all topics including their topics IDs so that their topic IDs can be reused by newer future topics?

Basically on my forum, i have many categories.

I have a category named ‘testing’

and it has many testing topics over few thousands.

At the same time, i have useful categories with valuable topics.

So on the forum, all those topics have mixed up incremented topics IDs like

As you can see from the topic IDs, due to too many test topics, my new topic IDs are getting incremented regularly, even if i manually delete all test topics in my ‘testing’ category, all the topic IDs are still taken, and new topics can never reuse them.

What i want to do is, e.g if my testing topic has ID 121 and i delete it permanently then if i create a new good topic on my site in any category then the new topic should be able to REUSE this 121 topic ID, instead of incrementing and creating new topic ID each time.

The problem is that my new topics topic ID is getting longer and longer, e.g its like 34214 and 43242 , if i remove all testing topics which are in count of approx 20121 , then i want my forum to be able to use SHORTED IDs for new topics, since if i permanently delete ALL testing topics, then my new topic ID should be reset to use the older deleted topic IDs. instead of incrementing the current ID count which is 34214 because the IDs are getting longer because of the bad testing topics IDs.

My whole point of doing this is so i can have shorter URLs and not have long topic IDs because of the 20121 topics which i created for testing purposes.

Once i remove all those 20121 testing topics which r in my ‘testing’ category, i want my new topics to use the older shorter topic IDs instead of having the topic ID 20122 which is just after 20121.

Should i follow this Deleting all topics in a category will it remove all topics and its posts as well or it will just remove the topics?

And will it free all the old used topic IDs of deleted topics so my new topics can reuse old IDs once new topics are created?

Please advise me what is best in my case. Should i bulk delete my ‘testing’ category so that those topic ID are destroyed and get available to be reused? please share me links and tutorials to destroy this in bulk without affecting the data of my normal good categories and topics.

All my bad testing topics are in ‘testing’ category. And i also dont want my site DB memory/storage to still have burden of the deleted testing topics which i am never gonna undo or undelete them as i will never use their topic IDs (or topic posts/content) again.

As far as i know, there is no option to permanently delete a topic in discourse and flush its deleted topic ID? As if i delete them from UI, i always see restore option… am i wrong?

1 Like

It will not.

Don’t worry about the topic id. That is best. Whether the topic id is 2 or 20000 it doesn’t make much difference.

If you really want your topic IDs to be smaller then you can either restore a backup from before you created those topics or you could wipe your whole database and start again.


It will not be good to destroy my entire DB as there are other useful good topics on the site in other categories.
What other way do i have to destroy this category topics permanently including their topic IDs? So that newer future topics can reuse the shorter older IDs?