A command-line tool for easy PostgreSQL table partitioning with zero downtime and minimal app changes.
pgslice is a command-line tool designed to simplify PostgreSQL table partitioning. It helps developers partition large tables by time periods (day, month, or year) to improve query performance and manage data growth. The tool supports both new and existing tables with zero downtime and minimal changes to the application layer.
Database administrators, backend engineers, and DevOps professionals working with PostgreSQL who need to manage large, time-series datasets efficiently.
Developers choose pgslice because it offers a safe, straightforward CLI for PostgreSQL partitioning without requiring deep database expertise. Its zero-downtime approach and compatibility with existing tables reduce operational complexity compared to manual partitioning methods.
Postgres partitioning as easy as pie
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a safe swap command to rename tables without interrupting database operations, as shown in the sample SQL output where the original table is renamed to _retired.
Handles tables with data via a batched fill process, allowing incremental data migration with configurable batch size and sleep options to control speed.
Provides intuitive commands like prep, fill, and swap that abstract complex SQL, making partitioning accessible without deep database expertise.
Supports partitioning by day, month, or year based on timestamp or date columns, with options to manage past and future partitions via cron jobs.
Limited to range partitioning by time periods; does not support other PostgreSQL partitioning methods like hash or list, which restricts use cases.
Triggers are not copied from the original table, requiring additional setup on the intermediate table, which can be error-prone and time-consuming.
Requires Ruby and libpq to install, which may add complexity in environments without these dependencies, as noted in the installation troubleshooting section.
For optimal performance, queries must explicitly include the partition column, but the tool doesn't enforce this, leaving it to app developers to implement.