This is the multi-page printable view of this section. .

Return to the regular view of this page.

PIG Documentation

Install, manage, and build PostgreSQL and its extensions with the pig CLI.

Packager Index Gateway, a PostgreSQL extension package manager

PIG is a self-contained Go command-line tool for installing, managing, and building PostgreSQL extension packages and for selected PostgreSQL/Pigsty operations. It delegates package transactions to the native operating-system tools. PIG is not a reinvented wheel, but rather a PiggyBack - a high-level abstraction layer that leverages existing Linux distribution package managers (apt/dnf). Its catalog maps operating systems, CPU architectures, and PostgreSQL majors to native package names, allowing you to install PG kernels and query 575 packaged extension entries through a consistent CLI. Availability still varies by target combination.

Many PIG-native workflows are automation-friendly: when the specific command documents support, use structured output, --plan, confirmation controls, and defined result codes. Passthrough, interactive, and streaming commands retain their upstream or terminal-oriented behavior.

Please note: for extension installation, pig is not a mandatory component. You can still use apt/dnf package managers to directly access the Pigsty PGSQL repository.

Open search and page actions with Ctrl with K ( with K on macOS), or press / to jump straight to commands.

Assistant actions open ChatGPT or Claude only when you select them. They pass the current page’s public URL and a reading prompt to that third-party service; PIG does not send the page body automatically.

Quick Start

Install pig

Use the default Cloudflare-backed installer:

BASH
curl -fsSL https://repo.pigsty.io/pig | bash

In mainland China, use the mirror endpoint:

BASH
curl -fsSL https://repo.pigsty.cc/pig | bash

See Installation for packages, release archives, upgrades, and removal.

Configure package repositories

On Linux, register the Pigsty and PGDG repositories once. Review the generated configuration before accepting the overwrite:

BASH
pig repo set

Install PostgreSQL and extensions

Install the PostgreSQL 18 kernel plus the pg_duckdb and vector extension packages:

BASH
pig install -y pg18 pg_duckdb vector

These commands install host packages. Use pig ext info NAME and each extension’s documentation to complete preload, restart, CREATE EXTENSION, and SQL upgrade steps in every intended database. Continue with the full Getting Started tutorial for catalog, alias, and inspection workflows.

Command Reference

Run pig help <command> to get detailed help for subcommands.

Extension Management:

  • pig repo: Manage software repositories
  • pig ext: Manage PG extensions
  • pig build: Build extensions from source
  • pig install: Install PostgreSQL and extension packages through the native package manager

Pigsty Management:

  • pig sty: Manage Pigsty installation and Grafana dashboards
  • pig inventory: Inspect, edit, validate, and exchange the Pigsty inventory
  • pig context: Collect host, PostgreSQL, Patroni, pgBackRest, and extension context
  • pig pg: Manage local PostgreSQL server
  • pig pt: Run patronictl transparently to manage Patroni HA clusters
  • pig pb: Manage pgBackRest backup & restore
  • pig pitr: Point-in-time recovery workflow

About

The pig CLI tool is developed by Vonng ([email protected]) and is open-sourced under the Apache 2.0 license.

You can also check out the PIGSTY project, which provides a complete PostgreSQL RDS DBaaS experience including extension delivery.

  • PGEXT: Extension data and management tools
  • PIG: PostgreSQL package manager
  • PIGSTY: Batteries-included PostgreSQL distribution