# Database seems inexplicably large

**URL:** <https://meta.discourse.org/t/database-seems-inexplicably-large/77872>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [1월 12, 2018, 7:28오후 UTC](https://meta.discourse.org/t/database-seems-inexplicably-large/77872 "2018-01-12T19:28:36Z")\
**Posts on this page:** 1\
**Showing post:** 1

<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:** [1월 12, 2018, 7:28오후 UTC](https://meta.discourse.org/t/database-seems-inexplicably-large/77872/1 "2018-01-12T19:28:36Z")

</div>

tl;dr: it looks like there are about 10GB of data reported by `rake db:stats`, but postgres\_data is taking up 18GB. Does it seem likely that there are 8GB of indexes taking up the rest of the space, or is there some kind of cleanup that needs to be done?

### Longer version of the same question

The postgres data directory is 18GB. A dump of the database is about 5GB.

```plaintext
var/discourse# du -hs shared/data/postgres_data/
18G shared/data/postgres_data/

```

Here’s what `rake db:stats` reveals. I truncated the rows reported in kB (about 10GB).

| table\_name | row\_estimate | size |
| --- | --- | --- |
| post\_timings | 49643076 | 3011 MB |
| posts | 2289502 | 990 MB |
| user\_actions | 5506773 | 915 MB |
| post\_search\_data | 2136003 | 875 MB |
| email\_logs | 2934363 | 717 MB |
| topic\_views | 3498593 | 507 MB |
| topic\_users | 3714046 | 448 MB |
| post\_stats | 1894296 | 319 MB |
| notifications | 1178136 | 296 MB |
| post\_replies | 1077331 | 127 MB |
| topics | 146814 | 107 MB |
| post\_actions | 456903 | 63 MB |
| draft\_sequences | 671770 | 54 MB |
| post\_revisions | 74596 | 51 MB |
| user\_profile\_views | 465818 | 49 MB |
| topic\_search\_data | 124471 | 46 MB |
| topic\_links | 160437 | 33 MB |
| scheduler\_stats | 168878 | 29 MB |
| uploads | 82100 | 22 MB |
| post\_custom\_fields | 35255 | 22 MB |
| top\_topics | 106478 | 21 MB |
| unsubscribe\_keys | 109936 | 19 MB |
| optimized\_images | 67107 | 18 MB |
| user\_histories | 77643 | 13 MB |
| topic\_link\_clicks | 124501 | 12 MB |

---

_[View the full topic](https://meta.discourse.org/t/database-seems-inexplicably-large/77872)._
