summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/catalog-pg-index.html
blob: 083c36ea7b21901cbb642420cf6fed6981c458d9 (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>53.26. pg_index</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalog-pg-foreign-table.html" title="53.25. pg_foreign_table" /><link rel="next" href="catalog-pg-inherits.html" title="53.27. pg_inherits" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.26. <code class="structname">pg_index</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-foreign-table.html" title="53.25. pg_foreign_table">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 53. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-inherits.html" title="53.27. pg_inherits">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-INDEX"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.26. <code class="structname">pg_index</code></h2></div></div></div><a id="id-1.10.4.28.2" class="indexterm"></a><p>
   The catalog <code class="structname">pg_index</code> contains part of the information
   about indexes.  The rest is mostly in
   <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a>.
  </p><div class="table" id="id-1.10.4.28.4"><p class="title"><strong>Table 53.26. <code class="structname">pg_index</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_index Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
       Column Type
      </p>
      <p>
       Description
      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indexrelid</code> <code class="type">oid</code>
       (references <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       The OID of the <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a> entry for this index
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indrelid</code> <code class="type">oid</code>
       (references <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       The OID of the <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a> entry for the table this index is for
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indnatts</code> <code class="type">int2</code>
      </p>
      <p>
       The total number of columns in the index (duplicates
       <code class="literal">pg_class.relnatts</code>); this number includes both key and included attributes
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indnkeyatts</code> <code class="type">int2</code>
      </p>
      <p>
       The number of <em class="firstterm">key columns</em> in the index,
       not counting any <em class="firstterm">included columns</em>, which are
       merely stored and do not participate in the index semantics
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisunique</code> <code class="type">bool</code>
      </p>
      <p>
       If true, this is a unique index
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indnullsnotdistinct</code> <code class="type">bool</code>
      </p>
      <p>
       This value is only used for unique indexes.  If false, this unique
       index will consider null values distinct (so the index can contain
       multiple null values in a column, the default PostgreSQL behavior).  If
       it is true, it will consider null values to be equal (so the index can
       only contain one null value in a column).
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisprimary</code> <code class="type">bool</code>
      </p>
      <p>
       If true, this index represents the primary key of the table
       (<code class="structfield">indisunique</code> should always be true when this is true)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisexclusion</code> <code class="type">bool</code>
      </p>
      <p>
       If true, this index supports an exclusion constraint
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indimmediate</code> <code class="type">bool</code>
      </p>
      <p>
       If true, the uniqueness check is enforced immediately on
       insertion
       (irrelevant if <code class="structfield">indisunique</code> is not true)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisclustered</code> <code class="type">bool</code>
      </p>
      <p>
       If true, the table was last clustered on this index
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisvalid</code> <code class="type">bool</code>
      </p>
      <p>
       If true, the index is currently valid for queries.  False means the
       index is possibly incomplete: it must still be modified by
       <a class="link" href="sql-insert.html" title="INSERT"><code class="command">INSERT</code></a>/<a class="link" href="sql-update.html" title="UPDATE"><code class="command">UPDATE</code></a> operations, but it cannot safely
       be used for queries. If it is unique, the uniqueness property is not
       guaranteed true either.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indcheckxmin</code> <code class="type">bool</code>
      </p>
      <p>
       If true, queries must not use the index until the <code class="structfield">xmin</code>
       of this <code class="structname">pg_index</code> row is below their <code class="symbol">TransactionXmin</code>
       event horizon, because the table may contain broken <a class="link" href="storage-hot.html" title="73.7. Heap-Only Tuples (HOT)">HOT chains</a> with
       incompatible rows that they can see
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisready</code> <code class="type">bool</code>
      </p>
      <p>
       If true, the index is currently ready for inserts.  False means the
       index must be ignored by <a class="link" href="sql-insert.html" title="INSERT"><code class="command">INSERT</code></a>/<a class="link" href="sql-update.html" title="UPDATE"><code class="command">UPDATE</code></a>
       operations.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indislive</code> <code class="type">bool</code>
      </p>
      <p>
       If false, the index is in process of being dropped, and should be
       ignored for all purposes (including HOT-safety decisions)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indisreplident</code> <code class="type">bool</code>
      </p>
      <p>
       If true this index has been chosen as <span class="quote"><span class="quote">replica identity</span></span>
       using <a class="link" href="sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY"><code class="command">ALTER TABLE ...
       REPLICA IDENTITY USING INDEX ...</code></a>
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indkey</code> <code class="type">int2vector</code>
       (references <a class="link" href="catalog-pg-attribute.html" title="53.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attnum</code>)
      </p>
      <p>
       This is an array of <code class="structfield">indnatts</code> values that
       indicate which table columns this index indexes.  For example, a value
       of <code class="literal">1 3</code> would mean that the first and the third table
       columns make up the index entries.  Key columns come before non-key
       (included) columns.  A zero in this array indicates that the
       corresponding index attribute is an expression over the table columns,
       rather than a simple column reference.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indcollation</code> <code class="type">oidvector</code>
       (references <a class="link" href="catalog-pg-collation.html" title="53.12. pg_collation"><code class="structname">pg_collation</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       For each column in the index key
       (<code class="structfield">indnkeyatts</code> values), this contains the OID
       of the collation to use for the index, or zero if the column is not of
       a collatable data type.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indclass</code> <code class="type">oidvector</code>
       (references <a class="link" href="catalog-pg-opclass.html" title="53.33. pg_opclass"><code class="structname">pg_opclass</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       For each column in the index key
       (<code class="structfield">indnkeyatts</code> values), this contains the OID
       of the operator class to use.  See
       <a class="link" href="catalog-pg-opclass.html" title="53.33. pg_opclass"><code class="structname">pg_opclass</code></a> for details.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indoption</code> <code class="type">int2vector</code>
      </p>
      <p>
       This is an array of <code class="structfield">indnkeyatts</code> values that
       store per-column flag bits.  The meaning of the bits is defined by
       the index's access method.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indexprs</code> <code class="type">pg_node_tree</code>
      </p>
      <p>
       Expression trees (in <code class="function">nodeToString()</code>
       representation) for index attributes that are not simple column
       references.  This is a list with one element for each zero
       entry in <code class="structfield">indkey</code>.  Null if all index attributes
       are simple references.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">indpred</code> <code class="type">pg_node_tree</code>
      </p>
      <p>
       Expression tree (in <code class="function">nodeToString()</code>
       representation) for partial index predicate.  Null if not a
       partial index.
      </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-foreign-table.html" title="53.25. pg_foreign_table">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-inherits.html" title="53.27. pg_inherits">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.25. <code class="structname">pg_foreign_table</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.6 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.27. <code class="structname">pg_inherits</code></td></tr></table></div></body></html>