pg_matviews — PostgreSQL system view

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

Summary

The view pg_matviews provides access to useful information about each materialized view in the database.

(Description quoted from the official PostgreSQL documentation.)

Columns

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

  • schemaname name references pg_namespace.nspname
    Name of schema containing materialized view
  • matviewname name references pg_class.relname
    Name of materialized view
  • matviewowner name references pg_authid.rolname
    Name of materialized view’s owner
  • tablespace name references pg_tablespace.spcname
    Name of tablespace containing materialized view (null if default for database)
  • hasindexes bool
    True if materialized view has (or recently had) any indexes
  • ispopulated bool
    True if materialized view is currently populated
  • definition text
    Materialized view definition (a reconstructed select query)

Related catalogs

This object references the following other system catalogs:

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_matviews.