45.46. System Views

In addition to the system catalogs, PostgreSQL provides a number of built-in views. Some system views provide convenient access to some commonly used queries on the system catalogs. Other views provide access to internal server state.

The information schema (Chapter 34) provides an alternative set of views which overlap the functionality of the system views. Since the information schema is SQL-standard whereas the views described here are PostgreSQL-specific, it's usually better to use the information schema if it provides all the information you need.

Table 45-47 lists the system views described here. More detailed documentation of each view follows below. There are some additional views that provide access to the results of the statistics collector; they are described in Table 27-1.

Except where noted, all the views described here are read-only.

Table 45-47. System Views

View NamePurpose
pg_cursorsopen cursors
pg_groupgroups of database users
pg_lockscurrently held locks
pg_prepared_statementsprepared statements
pg_prepared_xactsprepared transactions
pg_rolesdatabase roles
pg_settingsparameter settings
pg_shadowdatabase users
pg_statsplanner statistics
pg_timezone_abbrevstime zone abbreviations
pg_timezone_namestime zone names
pg_userdatabase users