pg_squeeze Extension
Postgres
Overview
Automatically cleans up unused space in tables (table bloat). pg_squeeze helps maintain optimal table performance by removing dead space that accumulates over time from UPDATE and DELETE operations.
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_squeeze:
- 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_squeeze and configure its parameters
- Click Queue extension changes to apply the configuration
- Once you're ready to apply the changes, click "Apply changes"
Parameters
squeeze.max_xlock_time
- Type: Integer (milliseconds)
- Default:
0
- Minimum:
0
- Description: The maximum time the processed table may be locked exclusively.
squeeze.worker_autostart
- Type: String
- Default:
postgres
- Description: Space-separated list of databases to start background workers for automatically.
squeeze.workers_per_database
- Type: Integer
- Default:
1
- Minimum:
1
- Description: Maximum number of worker processes launched per database. Must be less than or equal to cluster-level max_worker_processes.
Usage
After enabling the extension through the dashboard, you can install it in your database:
CREATE EXTENSION IF NOT EXISTS pg_squeeze;
Then you can schedule tables for squeezing:
-- Schedule a table to be squeezed SELECT squeeze.squeeze_table('public', 'your_table_name');
External Documentation
For more detailed information about pg_squeeze usage and configuration, see the official pg_squeeze documentation.
Need help?
Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.