pg_partman_bgw Extension
Overview
A background worker for managing partitioned tables in PostgreSQL. It automates the creation and maintenance of partitioned tables, making it easier to manage large datasets.
Dashboard Configuration
This extension requires activation via the PlanetScale Dashboard before it can be used. It must be enabled through shared libraries and requires a database restart.
To enable pg_partman_bgw:
- From the PlanetScale organization dashboard, select the desired database
- Navigate to the Cluster configuration page from the menu on the left
- Choose the branch whose extensions you'd like to configure in the "Branch" dropdown
- Select the Extensions tab
- Enable pg_partman_bgw and configure its parameters
- Click Queue extension changes to apply the configuration
- Once you're ready to apply the changes, click "Apply changes"
Parameters
pg_partman_bgw.interval
- Type: Integer
- Default:
3600
- Description: Interval (in seconds) between partition maintenance runs.
pg_partman_bgw.dbname
- Type: String
- Default:
postgres
- Description: Database name where the background worker should connect.
pg_partman_bgw.role
- Type: String
- Default:
postgres
- Description: Role that the background worker should use when connecting.
pg_partman_bgw.analyze
- Type: Boolean
- Default:
false
- Description: Whether to run ANALYZE on newly created partitions.
pg_partman_bgw.jobmon
- Type: Boolean
- Default:
true
- Description: Enable job monitoring for partition maintenance activities.
Usage
After enabling the extension through the dashboard, the background worker will automatically run partition maintenance based on your pg_partman configuration. You'll also need to install the pg_partman extension:
CREATE EXTENSION IF NOT EXISTS pg_partman;
The background worker works in conjunction with pg_partman to automatically maintain your partitioned tables.
External Documentation
For more detailed information about pg_partman and pg_partman_bgw usage, see the official pg_partman documentation.
Need help?
Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.