Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91da84a
feat: add pg_repack container image
thomasboussekey Apr 2, 2026
c0a2cad
Merging
thomasboussekey Apr 2, 2026
ce7d19d
docs: add README part for pg_repack
thomasboussekey Apr 2, 2026
d8e79be
Merge branch 'main' into dev/pg_repack
thomasboussekey Apr 2, 2026
3f0f985
chore: add entries in bake.yml
thomasboussekey Apr 2, 2026
3418f3b
Merge branch 'dev/pg_repack' of github.com:thomasboussekey/postgres-e…
thomasboussekey Apr 2, 2026
dc8601b
fix: add missing variable in metadata.hcl
thomasboussekey Apr 2, 2026
0f6acaa
fix: uncomment useful lines in Dockerfile
thomasboussekey Apr 2, 2026
27e4240
rebase
thomasboussekey May 7, 2026
44969f8
chore(deps): update registry docker tag to v3.1.0 (#178)
renovate[bot] Apr 13, 2026
e0e02fc
chore(deps): update alpine/kubectl:1.35.3 docker digest to c4a11ae (#…
renovate[bot] Apr 13, 2026
c064220
fix: allow UpdateOSLibs to handle packages without an MD5Sum (#164)
NiccoloFei Apr 15, 2026
d79e752
fix(PostGIS): pin the version of the scripts package (#186)
NiccoloFei Apr 17, 2026
c70f8d2
chore: update postgis OS libraries (#151)
cnpg-bot Apr 20, 2026
8fa65fa
chore: update dagger modules with security fixes (#191)
sxd Apr 20, 2026
82a5790
chore(deps): update all github action (#176)
renovate[bot] Apr 20, 2026
d36a15c
chore: update go dependencies of Dagger module maintenance (#192)
sxd Apr 20, 2026
79dcdd8
chore(deps): update alpine/kubectl docker tag to v1.35.4 (#190)
renovate[bot] Apr 20, 2026
d1e9842
chore(deps): update dependency postgresql-18-postgis-3 (#183)
renovate[bot] Apr 21, 2026
450d27c
ci: avoid triggering CI for all extensions on non-impactful shared fi…
NiccoloFei Apr 23, 2026
a41a3e5
chore: enable Renovate's auto-merge (#196)
NiccoloFei Apr 28, 2026
27b13f8
chore(deps): update sigstore/cosign-installer action to v4 (#188)
renovate[bot] Apr 29, 2026
6e58a0d
Merge branch 'dev/pg_repack' of github.com:thomasboussekey/postgres-e…
thomasboussekey May 7, 2026
93465e4
docs: improvements
thomasboussekey May 22, 2026
9f8ec3a
Merge branch 'cloudnative-pg:main' into dev/pg_repack
thomasboussekey May 22, 2026
029f331
fix: missing README diff + metadata HCL syntax
thomasboussekey May 22, 2026
0015451
Merge branch 'main' into dev/pg_repack
thomasboussekey May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ from a trusted, auditable repository
| :--- | :--- | :--- | :--- |
| **[pgAudit](pgaudit)** | PostgreSQL audit extension | [github.com/pgaudit/pgaudit](https://github.com/pgaudit/pgaudit) | CNPG maintainers |
| **[pg_crash](pg-crash)** | **Disruptive** fault injection and chaos engineering extension | [github.com/cybertec-postgresql/pg_crash](https://github.com/cybertec-postgresql/pg_crash) | CNPG maintainers |
| **[pg_repack](pgrepack)** | re-organize bloated tables and indexes | [github.com/reorg/pg_repack](https://github.com/reorg/pg_repack) |
| **[pgvector](pgvector)** | Vector similarity search for PostgreSQL | [github.com/pgvector/pgvector](https://github.com/pgvector/pgvector) | CNPG maintainers |
| **[PostGIS](postgis)** | Geospatial database extension for PostgreSQL | [postgis.net/](https://postgis.net/) | CNPG maintainers |
| **[TimescaleDB Apache-2 Edition](timescaledb-oss)** | Time-series database for PostgreSQL (open source version) | [github.com/timescale/timescaledb/](https://github.com/timescale/timescaledb/) | @shusaan |
Expand Down
36 changes: 36 additions & 0 deletions pgrepack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0


ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
FROM $BASE AS builder

ARG PG_MAJOR
ARG EXT_VERSION

USER 0

# TODO: Remove this comment block after customizing the Dockerfile
# Instructions:
# 1. Remove all TODO comment blocks after completing the customization.
# 2. Uncomment and customize the COPY/RUN commands below.
# 3. If your extension requires additional system libraries, ensure they are
# copied to /lib.

# Install extension via `apt-get`
RUN apt-get update && apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-repack=${EXT_VERSION}"

FROM scratch
ARG PG_MAJOR

# Licenses
COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-repack/copyright /licenses/postgresql-${PG_MAJOR}-repack/

# Libraries
COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/pg_repack* /lib/

# Share
COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/pg_repack* /share/extension/

USER 65532:65532
120 changes: 120 additions & 0 deletions pgrepack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Pg_repack
<!--
SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
SPDX-License-Identifier: Apache-2.0
-->

The pg_repack PostgreSQL extension provides a binary tool that can perform online operation that can remove bloat from tables and indexes. For more information, see the [official documentation](https://reorg.github.io/pg_repack/).

## Usage

A typical usage involves first installing the extension

```sql
CREATE EXTENSION pg_repack;
```

and then invoking the command-line tool. For example, to repack a bloated table called orders in the mydb database while keeping it fully accessible, you would run:

```shell
pg_repack -h localhost -U postgres -d mydb -t orders
```

To also reorder the table data along a specific index (e.g., orders_created_at_idx) for better read performance, you would use:

```shell
pg_repack -h localhost -U postgres -d mydb -t orders --order-by created_at
```

For a full-database repack targeting all eligible tables, simply omit the -t flag: pg_repack -d mydb. It is important to ensure that the target tables have a primary key or a unique, non-null index, as pg_repack requires one to correctly track row-level changes during the copy phase. Overall, pg_repack is an indispensable tool for DBAs managing large, write-heavy PostgreSQL databases where table bloat accumulates over time and downtime is not an option.

### 1. Add the pg_repack extension image to your Cluster

Define the `pg_repack` extension under the `postgresql.extensions` section of
your `Cluster` resource. For example:

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-pg_repack
spec:
imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
instances: 1

storage:
size: 1Gi

postgresql:
extensions:
- name: pg_repack
image:
# renovate: suite=trixie-pgdg depName=postgresql-18-pg_repack
reference: ghcr.io/cloudnative-pg/pg_repack:1.0-18-trixie
```

### 2. Enable the extension in a database

You can install `pg_repack` in a specific database by creating or updating a
`Database` resource. For example, to enable it in the `app` database:

```yaml
apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: cluster-pg_repack-app
spec:
name: app
owner: app
cluster:
name: cluster-pg_repack
extensions:
- name: pg_repack
# renovate: suite=trixie-pgdg depName=postgresql-18-pg_repack extractVersion=^(?<version>\d+\.\d+\.\d+)
version: '1.0'
```

<!--
TODO: Adjust the extractVersion regex pattern above based on your extension's versioning scheme
Examples: \d+\.\d+ for major.minor (e.g., "18.0"), \d+\.\d+\.\d+ for major.minor.patch (e.g., "0.8.2")
-->

### 3. Verify installation

Once the database is ready, connect to it with `psql` and run:

```sql
\dx
```

You should see `pg_repack` listed among the installed extensions.

## Contributors

This extension is maintained by:

- Thomas Boussekey (@thomasboussekey)

The maintainers are responsible for:

- Monitoring upstream releases and security vulnerabilities.
- Ensuring compatibility with supported PostgreSQL versions.
- Reviewing and merging contributions specific to this extension's container
image and lifecycle.

---

## Licenses and Copyright

This container image contains software that may be licensed under various
open-source licenses.

All relevant license and copyright information for the `pg_repack` extension
and its dependencies are bundled within the image at:

```text
/licenses/
```

By using this image, you agree to comply with the terms of the licenses
contained therein.
41 changes: 41 additions & 0 deletions pgrepack/metadata.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
metadata = {
name = "pgrepack"
sql_name = "pg_repack"
image_name = "pgrepack"
licenses = ["BSD-3-Clause"]
shared_preload_libraries = ["pg_repack"]
extension_control_path = []
dynamic_library_path = []
ld_library_path = []
bin_path = ["/usr/bin"]
auto_update_os_libs = false
required_extensions = []
create_extension = true

# TODO: Add these missing variables in the template
env = {}
postgresql_parameters = {}

versions = {
trixie = {
"18" = {
// renovate: suite=trixie-pgdg depName=postgresql-18-pg_repack
package = "1.5.3-1.pgdg13+1"
// Examples: \d+\.\d+ for major.minor (e.g., "18.0"), \d+\.\d+\.\d+ for major.minor.patch (e.g., "0.8.2")
// renovate: suite=trixie-pgdg depName=postgresql-18-pg_repack extractVersion=^(?<version>\d+\.\d+\.\d+)
sql = "1.5.3"
}
}
bookworm = {
"18" = {
// renovate: suite=bookworm-pgdg depName=postgresql-18-pg_repack
package = "1.5.3-1.pgdg12+1"
// Examples: \d+\.\d+ for major.minor (e.g., "18.0"), \d+\.\d+\.\d+ for major.minor.patch (e.g., "0.8.2")
// renovate: suite=bookworm-pgdg depName=postgresql-18-pg_repack extractVersion=^(?<version>\d+\.\d+\.\d+)
sql = "1.5.3"
}
}
}
}