1,247 stars · MIT · no GitHub releases at all; the RubyGems gem pgslice is at 0.7.2 · Track this in Scout
A command-line tool that builds a partitioned copy of a large PostgreSQL table beside the original and swaps them, without taking the database down.
▶Repo detailsthe review · specs · pros & cons · install
What it is
pgslice is a command-line tool that prepares, fills and swaps a partitioned copy of an existing PostgreSQL table (partitioning means storing one logical table as many physical pieces, split by date or by number). Each stage is a separate command, and each one prints the SQL it is about to run.
What it is good for. Anyone with a table of events, logs, orders or measurements that has quietly grown past ten million rows and is now the reason the reports are slow. It also gives an easy way to delete old data: dropping last year's piece is instant, where deleting a year of rows can take hours and bloat the table.
- It never rewrites the live table. It builds a new partitioned one beside it, copies the data in batches, and swaps the names at the end. Every stage can be stopped.
--dry-runprints the exact SQL without running it, so the whole plan can be read, saved, and handed to somebody else to check.- Nothing runs permanently. There is no service, no extension to install in the database, and nothing left behind afterwards.
- It is a Ruby program, so Ruby has to be available — or the container image used instead. That is an odd dependency for a PostgreSQL tool.
- There are no GitHub releases at all. We looked, and the answer is none: the version to trust is the
pgslicegem, at 0.7.2. The code itself was last touched on 29 June 2026. - It partitions and then stops. Creating next month's piece before it is needed is a job for a scheduled task you write, or for one of the alternatives below.
- pgpartman/pg_partman
2,797 stars, a PostgreSQL extension that keeps creating and retiring pieces on a schedule; more capable and permanent, and it has to be installed into the database itself.
Track this in Scout
timescale/timescaledb23,595 stars, an extension that turns PostgreSQL into a time-series database and handles the splitting automatically; a much bigger commitment for a much bigger gain on time-based data.
Track this in Scout- ankane/pgsync
3,476 stars, the same author's tool for copying data between PostgreSQL databases; a different job, listed because it is the companion people reach for next.
Track this in Scout
gem install pgslice export PGSLICE_URL=postgres://user:password@localhost/mydb pgslice prep events created_at month --dry-run
