pg_regresql
pg_regresql : Trust pg_class statistics for planning instead of physical relation size
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3230 | pg_regresql
|
pg_regresql
|
2.0.0 |
LANG
|
BSD-2-Clause
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd-r
|
No
|
Yes
|
Yes
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | pg_hint_plan
hypopg
plan_filter
auto_explain
|
Activate it with LOAD pg_regresql or session_preload_libraries.
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
2.0.0 |
18
17
16
15
14
|
pg_regresql |
- |
| RPM | PIGSTY
|
2.0.0 |
18
17
16
15
14
|
pg_regresql_$v |
- |
| DEB | PIGSTY
|
2.0.0 |
18
17
16
15
14
|
postgresql-$v-pg-regresql |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
el8.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
el9.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
el9.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
el10.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
el10.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
d12.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
d12.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
d13.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
d13.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
u22.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
u22.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
u24.x86_64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
u24.aarch64
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
PIGSTY 2.0.0
|
Source
pig build pkg pg_regresql; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_regresql; # install via package name, for the active PG version
pig install pg_regresql -v 18; # install for PG 18
pig install pg_regresql -v 17; # install for PG 17
pig install pg_regresql -v 16; # install for PG 16
pig install pg_regresql -v 15; # install for PG 15
pig install pg_regresql -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pg_regresql';Create this extension with:
CREATE EXTENSION pg_regresql;Usage
Syntax:
regresql init postgres://localhost/mydb regresql add src/sql/ regresql update regresql testSources: README, Product page
RegreSQL is documented upstream as a language-agnostic SQL regression testing tool for PostgreSQL, not as a CREATE EXTENSION-style in-database module. It discovers .sql files, runs them against PostgreSQL, snapshots expected output, and tracks query plan changes.
Quick Start
The README’s basic workflow is:
regresql init postgres://localhost/mydb
regresql discover
regresql add src/sql/
regresql update
regresql testThis initializes a test suite, discovers query files, creates plan definitions, captures expected output, and runs regression checks.
What It Tracks
The upstream docs emphasize:
- expected query output snapshots
EXPLAINplan baselines- sequential scan warnings
- migration-related query regressions
- CI-oriented output formats such as
junit,json,pgtap, andgithub-actions
Query Files and Plans
RegreSQL works with normal SQL files and supports multiple queries per file using -- name: annotations:
-- name: get-user-by-id
SELECT * FROM users WHERE id = :id;Plan files provide test parameters:
"1":
id: 42
"2":
id: 100Snapshots and Migrations
The tool can build and restore database snapshots and compare query behavior across migrations:
regresql snapshot build
regresql snapshot restore
regresql migrate --script db/migrations/001_add_column.sqlInstallation
The README documents installation via Homebrew or Go:
brew tap boringsql/boringsql
brew install regresqlor
go install github.com/boringsql/regresql@latestPostgreSQL client tools such as pg_dump, pg_restore, and psql are required for snapshot commands.