Data and databases · Edition No. 32 · 26 Sep 2026

ankane/pgslice

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.

← Data and databasesRead the whole edition →
05

ankane/pgslice

💎 hidden gem

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.

Stars1,247
LicenceMIT
Latestno GitHub releases at all; the RubyGems gem pgslice is at 0.7.2
Good
  • 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-run prints 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.
Watch for
  • 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 pgslice gem, 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.
Similar repositories
  • 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/timescaledb

    23,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
Install
gem install pgslice
export PGSLICE_URL=postgres://user:password@localhost/mydb
pgslice prep events created_at month --dry-run
Screenshots
ankane/pgslice: GitHub preview card

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.