Skip to content

pgdd

Introspect pg data dictionary via standard SQL

pgdd · Introspect pg data dictionary via standard SQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
5130pgddpgdd0.6.1ADMINMITRust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.6.119 18 17 16 15pgdd-
RPMPIGSTY0.6.119 18 17 16 15pgdd_$v-
DEBPIGSTY0.6.119 18 17 16 15postgresql-$v-pgdd-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
el8.aarch64N/APIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
el9.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
el9.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
el10.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
el10.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
d12.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
d12.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
d13.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
d13.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u22.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u22.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u24.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u24.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u26.x86_64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
u26.aarch64PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1PIGSTY 0.6.1
PackageVersionOSORGSIZEFile URL
pgdd_190.6.1el9.x86_64pigsty880.1 KiBpgdd_19-0.6.1-4PGSTY.el9.x86_64.rpm
pgdd_190.6.1el9.aarch64pigsty846.5 KiBpgdd_19-0.6.1-4PGSTY.el9.aarch64.rpm
pgdd_190.6.1el10.x86_64pigsty881.1 KiBpgdd_19-0.6.1-4PGSTY.el10.x86_64.rpm
pgdd_190.6.1el10.aarch64pigsty848.0 KiBpgdd_19-0.6.1-4PGSTY.el10.aarch64.rpm
postgresql-19-pgdd0.6.1d12.x86_64pigsty592.7 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~bookworm_amd64.deb
postgresql-19-pgdd0.6.1d12.aarch64pigsty518.9 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~bookworm_arm64.deb
postgresql-19-pgdd0.6.1d13.x86_64pigsty593.3 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~trixie_amd64.deb
postgresql-19-pgdd0.6.1d13.aarch64pigsty518.0 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~trixie_arm64.deb
postgresql-19-pgdd0.6.1u22.x86_64pigsty659.7 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~jammy_amd64.deb
postgresql-19-pgdd0.6.1u22.aarch64pigsty613.9 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~jammy_arm64.deb
postgresql-19-pgdd0.6.1u24.x86_64pigsty657.5 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~noble_amd64.deb
postgresql-19-pgdd0.6.1u24.aarch64pigsty605.6 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~noble_arm64.deb
postgresql-19-pgdd0.6.1u26.x86_64pigsty648.3 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~resolute_amd64.deb
postgresql-19-pgdd0.6.1u26.aarch64pigsty604.1 KiBpostgresql-19-pgdd_0.6.1-4PGSTY~resolute_arm64.deb

Source

pig build pkg pgdd;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pgdd;		# install by package name

pig install pgdd -v 19;   # install for PG 19
pig install pgdd -v 18;   # install for PG 18
pig install pgdd -v 17;   # install for PG 17
pig install pgdd -v 16;   # install for PG 16
pig install pgdd -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pgdd;

Usage

pgdd: Introspect pg data dictionary via standard SQL

PgDD provides data dictionary views in the dd schema for introspecting database objects via standard SQL.

Database Overview

SELECT * FROM dd.database;

Returns: db_name, db_size, schema_count, table_count, size_in_tables, view_count, size_in_views, extension_count.

Schemas

SELECT s_name, table_count, view_count, function_count, size_plus_indexes, description
  FROM dd.schemas;

Tables

SELECT t_name, size_pretty, rows, bytes_per_row
  FROM dd.tables
  WHERE s_name = 'public';

Views

SELECT s_name, v_name, description FROM dd.views;

Columns

SELECT source_type, s_name, t_name, c_name, data_type
  FROM dd.columns
  WHERE data_type LIKE 'int%';

Functions

SELECT s_name, f_name, argument_data_types, result_data_types FROM dd.functions;

Partitioned Tables

SELECT * FROM dd.partition_parents WHERE s_name = 'public';
SELECT * FROM dd.partition_children WHERE s_name = 'public';

The partition_parents view shows aggregate partition stats (count, total size, total rows). The partition_children view shows per-partition details with percentage calculations against the parent.

System objects are excluded by default. To include them, query the underlying functions directly: SELECT * FROM dd.tables() WHERE system_object;

Table reader