pgdd

pgdd : Introspect pg data dictionary via standard SQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
5130
pgdd
pgdd
0.6.1
ADMIN
MIT
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
Schemasdd
See Also
pg_catcheck
pg_orphaned
pg_checksums

manual updated pgrx by Vonng

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.6.1
18
17
16
15
14
pgdd-
RPM
PIGSTY
0.6.1
18
17
16
15
14
pgdd_$v-
DEB
PIGSTY
0.6.1
18
17
16
15
14
postgresql-$v-pgdd-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
el8.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
el9.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
el9.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
el10.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
el10.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
d12.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
d12.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
d13.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
d13.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
u22.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
u22.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
u24.x86_64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
u24.aarch64
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1
PIGSTY 0.6.1

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 via package name, for the active PG version

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
pig install pgdd -v 14;   # install for PG 14

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;

Last updated on