Vacuum and analyze PostgreSQL
Reclaim dead space and refresh the planner's statistics on a PostgreSQL database, or on the tables you list.
Install v1.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/pg-vacuum-analyze/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/pg-vacuum-analyze/1.0.0/template.yaml
Facts
- Category
- Databases
- Tags
- databases postgres
- Entrypoint
vacuum- Template SHA-256
c37b32e276a1867affee0412783fe38180df7df6194fa59326fbde739fc92638- Source
- pg-vacuum-analyze at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
cgr.dev/chainguard/postgres | latest-dev | sha256:dfc3fba4527ef4bf91eaf9ee518589447f4f2ca3bea47c914bc50e959b3721cb |
Parameters
| Name | Description | Default |
|---|---|---|
database required |
Database to connect to. | none |
host required |
PostgreSQL server host. Example db.internal |
none |
user required |
User to connect as. | none |
full |
Set to "true" for VACUUM FULL, which rewrites the tables and locks them while it runs. One of true, false |
false |
password-secret-key |
Key in that Secret that holds the password. | password |
password-secret-name |
Name of the Kubernetes Secret that holds the user's password. | postgres-password |
port |
PostgreSQL server port. | 5432 |
tables |
Comma-separated tables to process. Leave blank to process the whole database. Example orders,order_items |
empty |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: pg-vacuum-analyze
labels:
dagweave.io/catalog-item: pg-vacuum-analyze
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "Databases"
spec:
entrypoint: vacuum
templates:
- name: vacuum
inputs:
parameters:
- name: host
- name: port
default: "5432"
- name: database
- name: user
- name: tables
default: ""
- name: full
default: "false"
- name: password-secret-name
default: "postgres-password"
- name: password-secret-key
default: "password"
retryStrategy:
limit: "2"
retryPolicy: OnError
backoff:
duration: 10s
factor: "2"
maxDuration: 2m
container:
# cgr.dev/chainguard/postgres:latest-dev
image: cgr.dev/chainguard/postgres@sha256:dfc3fba4527ef4bf91eaf9ee518589447f4f2ca3bea47c914bc50e959b3721cb
command: [sh, -c]
args:
- |
set -eu
set -- --analyze --verbose
if [ "${FULL}" = "true" ]; then set -- "$@" --full; fi
if [ -n "${TABLES}" ]; then
IFS=,
for t in ${TABLES}; do set -- "$@" --table="${t}"; done
fi
vacuumdb "$@"
env:
- name: PGHOST
value: "{{inputs.parameters.host}}"
- name: PGPORT
value: "{{inputs.parameters.port}}"
- name: PGDATABASE
value: "{{inputs.parameters.database}}"
- name: PGUSER
value: "{{inputs.parameters.user}}"
- name: TABLES
value: "{{inputs.parameters.tables}}"
- name: FULL
value: "{{inputs.parameters.full}}"
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: "{{inputs.parameters.password-secret-name}}"
key: "{{inputs.parameters.password-secret-key}}"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 512Mi
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.0 latest 2026-10-18
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/pg-vacuum-analyze/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/pg-vacuum-analyze/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/pg-vacuum-analyze \
-p database=... \
-p host=db.internal \
-p user=...
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: pg-vacuum-analyze-
spec:
workflowTemplateRef:
name: pg-vacuum-analyze
arguments:
parameters:
- name: database
value: "..."
- name: host
value: "db.internal"
- name: user
value: "..."
As a step of a larger workflow
steps:
- - name: pg-vacuum-analyze
templateRef:
name: pg-vacuum-analyze
template: vacuum