Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/system-views.sgml`
a919d64d79e05d28a29c0027984a19e29b443f2169ec8d210000000100000feb
 linkend="client-authentication"/> for more information about
   client authentication configuration.
  </para>
 </sect1>

 <sect1 id="view-pg-indexes">
  <title><structname>pg_indexes</structname></title>

  <indexterm zone="view-pg-indexes">
   <primary>pg_indexes</primary>
  </indexterm>

  <para>
   The view <structname>pg_indexes</structname> provides access to
   useful information about each index in the database.
  </para>

  <table>
   <title><structname>pg_indexes</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>schemaname</structfield> <type>name</type>
       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
      </para>
      <para>
       Name of schema containing table and index
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tablename</structfield> <type>name</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
      </para>
      <para>
       Name of table the index is for
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>indexname</structfield> <type>name</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
      </para>
      <para>
       Name of index
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tablespace</structfield> <type>name</type>
       (references <link linkend="catalog-pg-tablespace"><structname>pg_tablespace</structname></link>.<structfield>spcname</structfield>)
      </para>
      <para>
       Name of tablespace containing index (null if default for database)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>indexdef</structfield> <type>text</type>
      </para>
      <para>
       Index definition (a reconstructed <xref linkend="sql-createindex"/>
       command)
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

 </sect1>

 <sect1 id="view-pg-locks">
  <title><structname>pg_locks</structname></title>

  <indexterm zone="view-pg-locks">
   <primary>pg_locks</primary>
  </indexterm>

  <para>
   The view <structname>pg_locks</structname> provides access to
   information about the locks held by active processes within the
   database server.  See <xref linkend="mvcc"/> for more discussion
   of locking.
  </para>

  <para>
   <structname>pg_locks</structname> contains one row per active lockable
   object, requested lock mode, and relevant process.  Thus, the same
   lockable object might
   appear many times, if multiple processes are holding or waiting
   for locks on it.  However, an object that currently has no locks on it
   will not appear at all.
  </para>

  <para>
   There are several distinct types of lockable objects:
   whole relations (e.g., tables), individual pages of relations,
   individual tuples of relations,
   transaction IDs (both virtual and permanent IDs),
   and general database objects (identified by class OID and object OID,
   in the same way as in <link linkend="catalog-pg-description"><structname>pg_description</structname></link> or
   <link linkend="catalog-pg-depend"><structname>pg_depend</structname></link>).  Also, the right to extend a
   relation is represented as a separate lockable object, as is the right to
   update <structname>pg_database</structname>.<structfield>datfrozenxid</structfield>.

Title: Database Views: pg_indexes, pg_locks
Summary
The pg_indexes view provides information about each index in the database, including schema name, table name, index name, and tablespace. The pg_locks view provides information about the locks held by active processes within the database server, including the type of lockable object, lock mode, and relevant process. The pg_locks view contains one row per active lockable object and can be used to monitor locks on various database objects, such as relations, pages, tuples, transaction IDs, and general database objects.