# Partitioning a large table in PostgreSQL with Rails

DevFeed: [Partitioning a large table in PostgreSQL with Rails](<https://devfeed.tech/articles/partitioning-a-large-table-in-postgresql-with-rails-33527.md>)

Original publisher: [Read original article](<https://www.aha.io/engineering/articles/partitioning-a-large-table-in-postgresql-with-rails>)

Published: 2025-04-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Aha! Engineering Blog](<https://devfeed.tech/sources/aha-engineering-blog.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Rails](<https://devfeed.tech/topics/rails.md>), [Database](<https://devfeed.tech/topics/database.md>), [Amazon RDS](<https://devfeed.tech/topics/amazon-rds.md>), [backups](<https://devfeed.tech/topics/backups.md>), [Amazon S3](<https://devfeed.tech/topics/amazon-s3.md>), [etl](<https://devfeed.tech/topics/etl.md>), [Disaster Recovery](<https://devfeed.tech/topics/disaster-recovery.md>), [datadog](<https://devfeed.tech/topics/datadog.md>)

Tags: [active-record](<https://devfeed.tech/tags/active-record.md>), [amazon-rds](<https://devfeed.tech/tags/amazon-rds.md>), [amazon-s3](<https://devfeed.tech/tags/amazon-s3.md>), [backups](<https://devfeed.tech/tags/backups.md>), [datadog](<https://devfeed.tech/tags/datadog.md>), [disaster-recovery](<https://devfeed.tech/tags/disaster-recovery.md>), [etl](<https://devfeed.tech/tags/etl.md>), [latency](<https://devfeed.tech/tags/latency.md>), [migration](<https://devfeed.tech/tags/migration.md>), [partitioning](<https://devfeed.tech/tags/partitioning.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rails](<https://devfeed.tech/tags/rails.md>)

## AI overview

This article explains how Aha! partitioned a very large PostgreSQL audit table used with Rails. It covers the migration strategy, operational and performance problems caused by billions of rows, and an archival process that moves audits older than 12 months to Amazon S3.

## Source excerpt

Keeping a reliable history of changes is essential for our users. They need to know when a record was updated, who made the change, and why. They could be anxiously awaiting a notification about a dependency that is blocking their work. Maybe they w