# Database cleanup before PostgreSQL 18 upgrade: recommended retention period for log/statistics tables?

**URL:** https://meta.discourse.org/t/database-cleanup-before-postgresql-18-upgrade-recommended-retention-period-for-log-statistics-tables/409130
**Category:** Support
**Created:** [3 augustus 2026 om 06:55 UTC](https://meta.discourse.org/t/database-cleanup-before-postgresql-18-upgrade-recommended-retention-period-for-log-statistics-tables/409130 "2026-08-03T06:55:29Z")
**Posts on this page:** 1
**Showing post:** 3

<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: [3 augustus 2026 om 15:27 UTC](https://meta.discourse.org/t/database-cleanup-before-postgresql-18-upgrade-recommended-retention-period-for-log-statistics-tables/409130/3 "2026-08-03T15:27:09Z")

</div>

> [@scavin](#):
>
> `ai_api_audit_logs 1.6 GB`

You can control the retention period of this one using site settings.

> [@scavin](#):
>
> 1. For tables like `incoming_links`, `topic_views`, and `post_timings`, do you normally keep all historical data, or periodically remove older records?

Those are meant to be kept forever, and they are usually the largest tables in most instances, so I wouldn’t worry about that.

---

_[View the full topic](https://meta.discourse.org/t/database-cleanup-before-postgresql-18-upgrade-recommended-retention-period-for-log-statistics-tables/409130)._
