pg_index.xml 8.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title id="gq143896">pg_index</title>
  <body>
    <p>The <codeph>pg_index</codeph> system catalog table contains part of the information about
      indexes. The rest is mostly in <xref href="pg_class.xml#topic1">pg_class</xref>.</p>
    <table id="gq143898">
      <title>pg_catalog.pg_index</title>
      <tgroup cols="4">
        <colspec colnum="1" colname="col1" colwidth="131pt"/>
        <colspec colnum="2" colname="col2" colwidth="70.5pt"/>
        <colspec colnum="3" colname="col3" colwidth="108pt"/>
        <colspec colnum="4" colname="col4" colwidth="147pt"/>
        <thead>
          <row>
            <entry colname="col1">column</entry>
            <entry colname="col2">type</entry>
            <entry colname="col3">references</entry>
            <entry colname="col4">description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry colname="col1">
              <codeph>indexrelid</codeph>
            </entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_class.oid</entry>
            <entry colname="col4">The OID of the pg_class entry for this index.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indrelid</codeph>
            </entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_class.oid</entry>
            <entry colname="col4">The OID of the pg_class entry for the table this index is
              for.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indnatts</codeph>
            </entry>
            <entry colname="col2">int2</entry>
            <entry colname="col3"/>
            <entry colname="col4">The number of columns in the index (duplicates
              pg_class.relnatts).</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisunique</codeph>
            </entry>
            <entry colname="col2">boolean </entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, this is a unique index.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisprimary</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, this index represents the primary key of the table.
              (indisunique should always be true when this is true.)</entry>
          </row>
68 69 70 71 72 73 74 75 76 77 78 79 80
          <row>
            <entry><codeph>indisexclusion</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, this index supports an exclusion constraint</entry>
          </row>
          <row>
            <entry>indimmediate</entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, the uniqueness check is enforced immediately on insertion (irrelevant if
                <codeph>indisunique</codeph> is not true)</entry>
          </row>
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
          <row>
            <entry colname="col1">
              <codeph>indisclustered</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, the table was last clustered on this index via the
                <codeph>CLUSTER</codeph> command.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisvalid</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, the index is currently valid for queries. False means the
              index is possibly incomplete: it must still be modified by
                <codeph>INSERT</codeph>/<codeph>UPDATE</codeph> operations, but it cannot safely be
              used for queries.</entry>
          </row>
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
          <row>
            <entry><codeph>indcheckxmin</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, queries must not use the index until the <codeph>xmin</codeph> of this
                <codeph>pg_index</codeph> row is below their <codeph>TransactionXmin</codeph> event
              horizon, because the table may contain broken HOT chains with incompatible rows that
              they can see</entry>
          </row>
          <row>
            <entry><codeph>indisready</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, the index is currently ready for inserts. False means the index must be
              ignored by <codeph>INSERT</codeph>/<codeph>UPDATE</codeph> operations</entry>
          </row>
          <row>
            <entry><codeph>indislive</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If false, the index is in process of being dropped, and should be ignored for all
              purposes </entry>
          </row>
          <row>
            <entry><codeph>indisreplident</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true this index has been chosen as "replica identity" using <codeph>ALTER
                TABLE ... REPLICA IDENTITY USING INDEX ...</codeph></entry>
          </row>
131 132 133 134 135 136
          <row>
            <entry colname="col1">
              <codeph>indkey</codeph>
            </entry>
            <entry colname="col2">int2vector</entry>
            <entry colname="col3">pg_attribute.attnum</entry>
137 138 139 140 141 142 143 144 145 146 147 148
            <entry colname="col4">This is an array of <codeph>indnatts</codeph> values that indicate
              which table columns this index indexes. For example a value of 1 3 would mean that the
              first and the third table columns make up the index key. A zero in this array
              indicates that the corresponding index attribute is an expression over the table
              columns, rather than a simple column reference.</entry>
          </row>
          <row>
            <entry><codeph>indcollation</codeph></entry>
            <entry>oidvector</entry>
            <entry/>
            <entry>For each column in the index key, this contains the OID of the collation to use
              for the index.</entry>
149 150 151 152 153 154 155 156 157
          </row>
          <row>
            <entry colname="col1">
              <codeph>indclass</codeph>
            </entry>
            <entry colname="col2">oidvector</entry>
            <entry colname="col3">pg_opclass.oid</entry>
            <entry colname="col4">For each column in the index key this contains the OID of the
              operator class to use.</entry>
158 159 160 161 162 163 164
          </row>
          <row>
            <entry><codeph>indoption</codeph></entry>
            <entry>int2vector</entry>
            <entry/>
            <entry>This is an array of <codeph>indnatts</codeph> values that store per-column flag
              bits. The meaning of the bits is defined by the index's access method.</entry>
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
          </row>
          <row>
            <entry colname="col1">
              <codeph>indexprs</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">Expression trees (in <codeph>nodeToString()</codeph>
              representation) for index attributes that are not simple column references. This is a
              list with one element for each zero entry in indkey. NULL if all index attributes are
              simple references.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indpred</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">Expression tree (in <codeph>nodeToString()</codeph>
              representation) for partial index predicate. NULL if not a partial index.</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </body>
</topic>