pg_stat_user_functions — PostgreSQL statistics view

The PostgreSQL pg_stat_user_functions statistics view: full column reference (names, types, descriptions), catalog relationships and version support.

Summary

The pg_stat_user_functions view will contain one row for each tracked function, showing statistics about executions of that function. The track_functions parameter controls exactly which functions are tracked.

(Description quoted from the official PostgreSQL documentation.)

Columns

The pg_stat_user_functions statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):

  • funcid oid
    OID of a function
  • schemaname name
    Name of the schema this function is in
  • funcname name
    Name of this function
  • calls bigint
    Number of times this function has been called
  • total_time double precision
    Total time spent in this function and all other functions called by it, in milliseconds
  • self_time double precision
    Total time spent in this function itself, not including other functions called by it, in milliseconds
  • stats_reset timestamp with time zone
    Time at which these statistics were last reset

Version applicability

Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.

Related & references

Reference: PostgreSQL documentation — pg_stat_user_functions.