# Come ridurre le dimensioni del database

**URL:** https://meta.discourse.org/t/how-to-reduce-database-size/110204
**Category:** Support
**Created:** [27 Febbraio 2019, 3:44am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204 "2019-02-27T03:44:42Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [27 Febbraio 2019, 3:44am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/1 "2019-02-27T03:44:42Z")

</div>

Let’s say I wanted to slim down the DB a tad by deleting 1000 topics from a category. Basically deleting topics that get no attention or have no reason to be up anymore. From my understanding, even if I delete these 1000 topics, it won’t have any effect on the database size what-so-ever, as nothing gets truly deleted with discourse, yes? How do bigger sites manage when they clean up unwanted posts if true.

---

<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: [27 Febbraio 2019, 4:39am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/2 "2019-02-27T04:39:59Z")

</div>

They don’t take up much room. If it were 20 years ago, this might be an issue. If your site had 1, 000,000 topics and you wanted to delete 800,000 then you might have a problem to solve.

---

<div class="post-metadata">

### Author: ![Tim\_Jefferies](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tim_jefferies/32/113296_2.png) [@Tim\_Jefferies](https://meta.discourse.org/u/Tim_Jefferies)
#### Post date: [27 Febbraio 2019, 4:40am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/3 "2019-02-27T04:40:10Z")

</div>

I’d like to know how to do this as well.

I want to create a category that auto deletes posts. The idea is to have a space where people can speak freely knowing that whatever they post will auto delete after a certain time i.e. for privacy reasons.

I have a category set to auto close topics after 168 hours.  
Now I need to figure out how to delve into the DB (I expect a crontab task is the best way to do this) and delete any posts including uploaded images from the server that belong to this category and are auto closed.

How would I do that?

---

<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: [27 Febbraio 2019, 4:59am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/4 "2019-02-27T04:59:10Z")

</div>

A plugin could destroy the deleted posts. If privacy is the concern then there could be reason to do this. It still assumes that you don’t have backups.

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [27 Febbraio 2019, 5:00am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/5 "2019-02-27T05:00:50Z")

</div>

That depends on the post type. 90% of my topics have at least two uploads in them, it adds up very quick.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [27 Febbraio 2019, 5:05am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/6 "2019-02-27T05:05:15Z")

</div>

But uploads aren’t stored in the DB, and on the op you talk about

> [@WorldIsMine](#):
>
> I wanted to slim down the DB

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [27 Febbraio 2019, 5:22am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/7 "2019-02-27T05:22:21Z")

</div>

Sorry I guess I made a mistake expressing myself. Just wanted to know if there is a easy way of slimming down the overall size of my instance in a easy way.

---

<div class="post-metadata">

### Author: ![Tim\_Jefferies](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tim_jefferies/32/113296_2.png) [@Tim\_Jefferies](https://meta.discourse.org/u/Tim_Jefferies)
#### Post date: [27 Febbraio 2019, 6:01am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/8 "2019-02-27T06:01:43Z")

</div>

> [@pfaffman](#):
>
> A plugin could destroy the deleted posts.

Is there a simple way to delete auto closed posts from a specific category via the linux commandline? (I’m not a programmer).

---

<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: [27 Febbraio 2019, 11:37am UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/9 "2019-02-27T11:37:37Z")

</div>

If disk space on the server is your issue, you could move images to S3.

You could use a rails console command to delete closed topics in a category.

---

<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: [1 Aprile 2022, 5:53pm UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/10 "2022-04-01T17:53:35Z")

</div>



---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [1 Aprile 2022, 6:31pm UTC](https://meta.discourse.org/t/how-to-reduce-database-size/110204/11 "2022-04-01T18:31:49Z")

</div>


