pg_squeeze
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_squeeze | 1.9.4 | ADMIN | BSD-2-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5040 | pg_squeeze | No | Yes | Yes | Yes | No | No | squeeze |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 1.9.4 | 1817161514 | pg_squeeze | - |
| RPM | PGDG | 1.9.4 | 1817161514 | pg_squeeze_$v | - |
| DEB | PGDG | 1.9.4 | 1817161514 | postgresql-$v-squeeze | - |
Install
You can install pg_squeeze directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
pg_squeeze removes bloat from a table and its indexes while allowing concurrent reads and writes. It copies live tuples to new storage and applies concurrent changes through logical decoding, avoiding the long exclusive lock of VACUUM FULL. Use it only after sizing replication slots, disk space, and the table’s replica identity.
Configure and Install
Restart PostgreSQL, then create the extension:
The table must have an identity index. A primary key works with the default replica identity; otherwise select a suitable unique index with ALTER TABLE ... REPLICA IDENTITY USING INDEX.
Run an Ad-Hoc Squeeze
The function starts background work and is not transactional in the ordinary SQL-function sense. Monitor the operation rather than assuming a surrounding ROLLBACK cancels it.
Schedule Tables and Monitor Work
The schedule tuple contains minutes, hours, days of month, months, and days of week. Registration also supports thresholds and placement options such as free_space_extra, min_size, vacuum_max_age, max_retry, clustering_index, relation/index tablespaces, and skip_analyze.
For automatic startup:
Version 1.9.4 and Operational Caveats
- Version 1.9.4 fixes unsafe quoting in dynamically constructed
ANALYZE, log, and error statements, including a superuser SQL-injection path. Upgrade earlier 1.9 builds promptly. - A full-table squeeze needs free disk space of roughly twice the combined size of the target table and its indexes.
- Disruptive DDL,
VACUUM FULL,CLUSTER, orTRUNCATEcan make an in-progress squeeze abort. Coordinate schema changes and usemax_retrydeliberately. - Like other online rewrite tools,
pg_squeezechanges row visibility and has documented MVCC caveats for concurrent sessions that retain old snapshots. - Configure
pg_squeezeinshared_preload_librarieson the new cluster beforepg_upgradeor dump/restore of a database containing the extension. - Current Pigsty packages cover PostgreSQL 14-18. For those versions, keep
wal_level = logical; upstream’s relaxed PostgreSQL 19 rule does not apply to this package matrix yet.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)