Databases

PostgreSQL

pg_stat_user_tables for write activity, pg_proc for function bodies, pg_stat_activity for live blocking.

PostgreSQL exposes more useful counters than SQL Server does, and exposes them more honestly. pg_stat_user_tables carries per-table insert, update and delete counts that survive as long as the statistics collector does, which makes runtime topology discovery unusually reliable here.

The catch is that most PostgreSQL ETL is not in PostgreSQL. Where SQL Server estates keep logic in stored procedures, Postgres estates tend to keep it in an external service or a transformation tool, so the database is a strong source for targets and volumes and a weaker one for transformation logic.

What is read

What Decim reads from PostgreSQL

Every item below is read-only, and each is a specific view, endpoint or file rather than a category of access. If something here is unacceptable in your environment, it can be removed from the query catalogue — see the agent for how that works.

PostgreSQL — metadata sources
What From Why it matters
Write activitypg_stat_user_tablesn_tup_ins, n_tup_upd, n_tup_del per table
Live row estimatepg_class.reltuplesCheap approximate counts without scanning
Function bodiespg_proc.prosrcPL/pgSQL logic where it exists
Dependency edgespg_depend, pg_rewriteView and function dependencies
Live contentionpg_stat_activity, pg_locksBlocking chains during a stall
Column metadatainformation_schema.columnsTypes and nullability
Table sizespg_total_relation_size()Growth anomalies over time

Permissions required

Written out in full, because "read-only access" is not a specification. Nothing below grants the ability to write, and row access is requested only on the specific tables you name.

Read-only role, PostgreSQL 10+ sql
CREATE ROLE decim_agent LOGIN PASSWORD '...';

-- Catalog and statistics views are readable by default.
GRANT CONNECT ON DATABASE sales TO decim_agent;
GRANT USAGE   ON SCHEMA  public TO decim_agent;

-- pg_stat_activity shows other sessions' queries only with this role
-- (PostgreSQL 10+). Without it, query text from other users is NULL.
GRANT pg_read_all_stats TO decim_agent;

-- Reconciliation tables, named explicitly.
GRANT SELECT ON public.intake_batch          TO decim_agent;
GRANT SELECT ON public.rejected_transactions TO decim_agent;

-- Never granted: write privileges, or blanket SELECT on the schema.
ALTER DEFAULT PRIVILEGES IN SCHEMA public
  REVOKE ALL ON TABLES FROM decim_agent;

What it builds

What this source contributes to the pipeline topology and to the evidence available during an investigation:

  • Target nodes and their write volumes from the statistics collector
  • Transform nodes where PL/pgSQL functions carry logic
  • View dependency edges from pg_depend
  • Contention evidence from live blocking chains

Nodes learned from a definition are marked declared; nodes observed running are marked observed; nodes both declared and observed are verified. Where two sources disagree, the disagreement is recorded as a drift note rather than resolved silently.

Failure modes

Failure modes it surfaces

What this source is uniquely good at proving — and, just as usefully, at disproving. An investigation that can refute a hypothesis cheaply is worth as much as one that confirms it.

Failure modes PostgreSQL evidence distinguishes
Failure mode The signal
Load wrote nothingn_tup_ins flat across the window
Duplicate loadn_tup_ins at roughly double the baseline
Blocking during a stallBlocking chain in pg_stat_activity
Autovacuum starvationlast_autovacuum far behind n_dead_tup

Limits

What this integration cannot tell you. Stated because an investigation that overstates its sources produces confident wrong answers, which is worse than an honest blocked.

  • Statistics counters reset on pg_stat_reset() and do not survive a crash-recovery restart
  • Transformation logic usually lives outside the database, so this source alone rarely yields transform nodes
  • reltuples is an estimate refreshed by ANALYZE — never cite it as an exact count

Related integrations

  • SQL Server — Reads catalog metadata, procedure bodies and write activity — the definitions git never sees.
  • Apache Airflow — The metadata database holds connections, variables, pools and manual state — none of it in git.
  • dbt — manifest.json is the model graph; run_results.json is what actually happened. Both are artefacts, not APIs.

See all integrations, or how the sources are combined into one graph.

Get started

Investigating a PostgreSQL pipeline?

Bring an incident you already know the answer to. If Decim gets it wrong, that is a more useful demo than one where it doesn't.