跳转到主要内容

pg_relusage

Log all the queries that reference a particular column

pg_relusage : Log all the queries that reference a particular column

Overview

ID Extension Package Version Category License Language
6850 pg_relusage pg_relusage 1.0.2 STAT PostgreSQL C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sL--r No Yes Yes No yes no
LOAD/preload enables logging; CREATE EXTENSION only records installation.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 1.0.2 18 17 16 15 14 pg_relusage -
RPM PIGSTY 1.0.2 18 17 16 15 14 pg_relusage_$v -
DEB PIGSTY 1.0.2 18 17 16 15 14 postgresql-$v-pg-relusage -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
el8.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
el9.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
el9.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
el10.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
el10.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
d12.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
d12.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
d13.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
d13.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u22.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u22.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u24.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u24.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u26.x86_64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
u26.aarch64 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2 PIGSTY 1.0.2
Package Version OS ORG SIZE File URL
pg_relusage_18 1.0.2 el8.x86_64 pigsty 39.3 KiB pg_relusage_18-1.0.2-1PGSTY.el8.x86_64.rpm
pg_relusage_18 1.0.2 el8.aarch64 pigsty 39.0 KiB pg_relusage_18-1.0.2-1PGSTY.el8.aarch64.rpm
pg_relusage_18 1.0.2 el9.x86_64 pigsty 39.8 KiB pg_relusage_18-1.0.2-1PGSTY.el9.x86_64.rpm
pg_relusage_18 1.0.2 el9.aarch64 pigsty 39.6 KiB pg_relusage_18-1.0.2-1PGSTY.el9.aarch64.rpm
pg_relusage_18 1.0.2 el10.x86_64 pigsty 40.0 KiB pg_relusage_18-1.0.2-1PGSTY.el10.x86_64.rpm
pg_relusage_18 1.0.2 el10.aarch64 pigsty 39.9 KiB pg_relusage_18-1.0.2-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-relusage 1.0.2 d12.x86_64 pigsty 30.4 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-relusage 1.0.2 d12.aarch64 pigsty 29.7 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-relusage 1.0.2 d13.x86_64 pigsty 30.4 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~trixie_amd64.deb
postgresql-18-pg-relusage 1.0.2 d13.aarch64 pigsty 29.8 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~trixie_arm64.deb
postgresql-18-pg-relusage 1.0.2 u22.x86_64 pigsty 32.4 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~jammy_amd64.deb
postgresql-18-pg-relusage 1.0.2 u22.aarch64 pigsty 32.3 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~jammy_arm64.deb
postgresql-18-pg-relusage 1.0.2 u24.x86_64 pigsty 31.7 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~noble_amd64.deb
postgresql-18-pg-relusage 1.0.2 u24.aarch64 pigsty 30.9 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~noble_arm64.deb
postgresql-18-pg-relusage 1.0.2 u26.x86_64 pigsty 31.3 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~resolute_amd64.deb
postgresql-18-pg-relusage 1.0.2 u26.aarch64 pigsty 31.2 KiB postgresql-18-pg-relusage_1.0.2-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_relusage_17 1.0.2 el8.x86_64 pigsty 39.2 KiB pg_relusage_17-1.0.2-1PGSTY.el8.x86_64.rpm
pg_relusage_17 1.0.2 el8.aarch64 pigsty 39.0 KiB pg_relusage_17-1.0.2-1PGSTY.el8.aarch64.rpm
pg_relusage_17 1.0.2 el9.x86_64 pigsty 39.7 KiB pg_relusage_17-1.0.2-1PGSTY.el9.x86_64.rpm
pg_relusage_17 1.0.2 el9.aarch64 pigsty 39.6 KiB pg_relusage_17-1.0.2-1PGSTY.el9.aarch64.rpm
pg_relusage_17 1.0.2 el10.x86_64 pigsty 40.0 KiB pg_relusage_17-1.0.2-1PGSTY.el10.x86_64.rpm
pg_relusage_17 1.0.2 el10.aarch64 pigsty 39.9 KiB pg_relusage_17-1.0.2-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-relusage 1.0.2 d12.x86_64 pigsty 30.3 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-relusage 1.0.2 d12.aarch64 pigsty 29.7 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-relusage 1.0.2 d13.x86_64 pigsty 30.2 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~trixie_amd64.deb
postgresql-17-pg-relusage 1.0.2 d13.aarch64 pigsty 29.8 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~trixie_arm64.deb
postgresql-17-pg-relusage 1.0.2 u22.x86_64 pigsty 36.2 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~jammy_amd64.deb
postgresql-17-pg-relusage 1.0.2 u22.aarch64 pigsty 36.2 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~jammy_arm64.deb
postgresql-17-pg-relusage 1.0.2 u24.x86_64 pigsty 31.5 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~noble_amd64.deb
postgresql-17-pg-relusage 1.0.2 u24.aarch64 pigsty 31.1 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~noble_arm64.deb
postgresql-17-pg-relusage 1.0.2 u26.x86_64 pigsty 31.2 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~resolute_amd64.deb
postgresql-17-pg-relusage 1.0.2 u26.aarch64 pigsty 31.1 KiB postgresql-17-pg-relusage_1.0.2-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_relusage_16 1.0.2 el8.x86_64 pigsty 39.2 KiB pg_relusage_16-1.0.2-1PGSTY.el8.x86_64.rpm
pg_relusage_16 1.0.2 el8.aarch64 pigsty 39.0 KiB pg_relusage_16-1.0.2-1PGSTY.el8.aarch64.rpm
pg_relusage_16 1.0.2 el9.x86_64 pigsty 39.7 KiB pg_relusage_16-1.0.2-1PGSTY.el9.x86_64.rpm
pg_relusage_16 1.0.2 el9.aarch64 pigsty 39.6 KiB pg_relusage_16-1.0.2-1PGSTY.el9.aarch64.rpm
pg_relusage_16 1.0.2 el10.x86_64 pigsty 40.0 KiB pg_relusage_16-1.0.2-1PGSTY.el10.x86_64.rpm
pg_relusage_16 1.0.2 el10.aarch64 pigsty 39.9 KiB pg_relusage_16-1.0.2-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-relusage 1.0.2 d12.x86_64 pigsty 30.3 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-relusage 1.0.2 d12.aarch64 pigsty 29.7 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-relusage 1.0.2 d13.x86_64 pigsty 30.2 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~trixie_amd64.deb
postgresql-16-pg-relusage 1.0.2 d13.aarch64 pigsty 29.8 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~trixie_arm64.deb
postgresql-16-pg-relusage 1.0.2 u22.x86_64 pigsty 35.8 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~jammy_amd64.deb
postgresql-16-pg-relusage 1.0.2 u22.aarch64 pigsty 35.8 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~jammy_arm64.deb
postgresql-16-pg-relusage 1.0.2 u24.x86_64 pigsty 31.5 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~noble_amd64.deb
postgresql-16-pg-relusage 1.0.2 u24.aarch64 pigsty 31.9 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~noble_arm64.deb
postgresql-16-pg-relusage 1.0.2 u26.x86_64 pigsty 31.3 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~resolute_amd64.deb
postgresql-16-pg-relusage 1.0.2 u26.aarch64 pigsty 31.2 KiB postgresql-16-pg-relusage_1.0.2-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_relusage_15 1.0.2 el8.x86_64 pigsty 39.2 KiB pg_relusage_15-1.0.2-1PGSTY.el8.x86_64.rpm
pg_relusage_15 1.0.2 el8.aarch64 pigsty 39.0 KiB pg_relusage_15-1.0.2-1PGSTY.el8.aarch64.rpm
pg_relusage_15 1.0.2 el9.x86_64 pigsty 39.7 KiB pg_relusage_15-1.0.2-1PGSTY.el9.x86_64.rpm
pg_relusage_15 1.0.2 el9.aarch64 pigsty 39.6 KiB pg_relusage_15-1.0.2-1PGSTY.el9.aarch64.rpm
pg_relusage_15 1.0.2 el10.x86_64 pigsty 39.9 KiB pg_relusage_15-1.0.2-1PGSTY.el10.x86_64.rpm
pg_relusage_15 1.0.2 el10.aarch64 pigsty 39.9 KiB pg_relusage_15-1.0.2-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-relusage 1.0.2 d12.x86_64 pigsty 30.3 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-relusage 1.0.2 d12.aarch64 pigsty 34.1 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-relusage 1.0.2 d13.x86_64 pigsty 30.2 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~trixie_amd64.deb
postgresql-15-pg-relusage 1.0.2 d13.aarch64 pigsty 29.8 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~trixie_arm64.deb
postgresql-15-pg-relusage 1.0.2 u22.x86_64 pigsty 35.7 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~jammy_amd64.deb
postgresql-15-pg-relusage 1.0.2 u22.aarch64 pigsty 35.7 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~jammy_arm64.deb
postgresql-15-pg-relusage 1.0.2 u24.x86_64 pigsty 31.5 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~noble_amd64.deb
postgresql-15-pg-relusage 1.0.2 u24.aarch64 pigsty 31.0 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~noble_arm64.deb
postgresql-15-pg-relusage 1.0.2 u26.x86_64 pigsty 31.2 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~resolute_amd64.deb
postgresql-15-pg-relusage 1.0.2 u26.aarch64 pigsty 31.2 KiB postgresql-15-pg-relusage_1.0.2-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_relusage_14 1.0.2 el8.x86_64 pigsty 39.2 KiB pg_relusage_14-1.0.2-1PGSTY.el8.x86_64.rpm
pg_relusage_14 1.0.2 el8.aarch64 pigsty 39.0 KiB pg_relusage_14-1.0.2-1PGSTY.el8.aarch64.rpm
pg_relusage_14 1.0.2 el9.x86_64 pigsty 39.6 KiB pg_relusage_14-1.0.2-1PGSTY.el9.x86_64.rpm
pg_relusage_14 1.0.2 el9.aarch64 pigsty 39.5 KiB pg_relusage_14-1.0.2-1PGSTY.el9.aarch64.rpm
pg_relusage_14 1.0.2 el10.x86_64 pigsty 39.9 KiB pg_relusage_14-1.0.2-1PGSTY.el10.x86_64.rpm
pg_relusage_14 1.0.2 el10.aarch64 pigsty 39.8 KiB pg_relusage_14-1.0.2-1PGSTY.el10.aarch64.rpm
postgresql-14-pg-relusage 1.0.2 d12.x86_64 pigsty 30.2 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~bookworm_amd64.deb
postgresql-14-pg-relusage 1.0.2 d12.aarch64 pigsty 29.6 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~bookworm_arm64.deb
postgresql-14-pg-relusage 1.0.2 d13.x86_64 pigsty 30.2 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~trixie_amd64.deb
postgresql-14-pg-relusage 1.0.2 d13.aarch64 pigsty 29.8 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~trixie_arm64.deb
postgresql-14-pg-relusage 1.0.2 u22.x86_64 pigsty 35.6 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~jammy_amd64.deb
postgresql-14-pg-relusage 1.0.2 u22.aarch64 pigsty 35.7 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~jammy_arm64.deb
postgresql-14-pg-relusage 1.0.2 u24.x86_64 pigsty 31.4 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~noble_amd64.deb
postgresql-14-pg-relusage 1.0.2 u24.aarch64 pigsty 30.8 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~noble_arm64.deb
postgresql-14-pg-relusage 1.0.2 u26.x86_64 pigsty 31.2 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~resolute_amd64.deb
postgresql-14-pg-relusage 1.0.2 u26.aarch64 pigsty 31.1 KiB postgresql-14-pg-relusage_1.0.2-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_relusage;		# 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 pg_relusage;		# install via package name, for the active PG version

pig install pg_relusage -v 18;   # install for PG 18
pig install pg_relusage -v 17;   # install for PG 17
pig install pg_relusage -v 16;   # install for PG 16
pig install pg_relusage -v 15;   # install for PG 15
pig install pg_relusage -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_relusage';

This extension does not need CREATE EXTENSION DDL command

Usage

Sources:

pg_relusage 1.0.2 logs relations used by statements after plan simplification. It supports PostgreSQL 10–18 and defines no SQL objects. Loading the library enables it; optional CREATE EXTENSION only records installation.

Core Workflow

LOAD 'pg_relusage';
SET pg_relusage.nested_statements = 'fold';
SET pg_relusage.log_level = 'notice';
CREATE TABLE relusage_demo (id integer);
SELECT * FROM relusage_demo;

Operational Boundaries

All settings require superuser: pg_relusage.enabled defaults on, pg_relusage.log_level defaults log and pg_relusage.rel_kinds defaults riSvmfp. pg_relusage.nested_statements accepts all (default: each statement), top (ignore nested statements) or fold (merge nested relations into the outer log). Version 1.0.1 fixes fold handling after a failed subtransaction.

Use session_preload_libraries for new sessions without a restart, or shared_preload_libraries for all sessions with a restart; preserve existing preload entries. LOAD normally requires superuser. Log messages omit SQL text, so configure log_line_prefix to identify the client.

System catalogs are excluded. Relations eliminated by planning or startup pruning are excluded, but partitions skipped later during execution can still appear. INSERT into a partitioned table reports only its parent. Deferred triggers at COMMIT, COPY FROM triggers and planner-invoked functions are treated as top-level statements. DDL and maintenance commands are excluded. A quiet log alone does not prove an object can be dropped.

1.0.2 and Partitioned Tables

Version 1.0.2 reduces relation-membership and partition-matching overhead for statements involving many partitions. Log format and settings are unchanged. Replace the library and restart if using shared preload, or reconnect when using session preload or LOAD. If installation was recorded with CREATE EXTENSION, also run ALTER EXTENSION pg_relusage UPDATE.