codekingpro/portable-devtools
114k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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 16.3 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> <a href="#CATALOG-PG-INDEX" class="id_link">#</a></h2></div></div></div><a id="id-1.10.4.28.2" class="indexterm"></a><p>3 The catalog <code class="structname">pg_index</code> contains part of the information4 about indexes. The rest is mostly in5 <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a>.6 </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">7 Column Type8 </p>9 <p>10 Description11 </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">12 <code class="structfield">indexrelid</code> <code class="type">oid</code>13 (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>)14 </p>15 <p>16 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 index17 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">18 <code class="structfield">indrelid</code> <code class="type">oid</code>19 (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>)20 </p>21 <p>22 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 for23 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">24 <code class="structfield">indnatts</code> <code class="type">int2</code>25 </p>26 <p>27 The total number of columns in the index (duplicates28 <code class="literal">pg_class.relnatts</code>); this number includes both key and included attributes29 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">30 <code class="structfield">indnkeyatts</code> <code class="type">int2</code>31 </p>32 <p>33 The number of <em class="firstterm">key columns</em> in the index,34 not counting any <em class="firstterm">included columns</em>, which are35 merely stored and do not participate in the index semantics36 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">37 <code class="structfield">indisunique</code> <code class="type">bool</code>38 </p>39 <p>40 If true, this is a unique index41 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">42 <code class="structfield">indnullsnotdistinct</code> <code class="type">bool</code>43 </p>44 <p>45 This value is only used for unique indexes. If false, this unique46 index will consider null values distinct (so the index can contain47 multiple null values in a column, the default PostgreSQL behavior). If48 it is true, it will consider null values to be equal (so the index can49 only contain one null value in a column).50 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">51 <code class="structfield">indisprimary</code> <code class="type">bool</code>52 </p>53 <p>54 If true, this index represents the primary key of the table55 (<code class="structfield">indisunique</code> should always be true when this is true)56 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">57 <code class="structfield">indisexclusion</code> <code class="type">bool</code>58 </p>59 <p>60 If true, this index supports an exclusion constraint61 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">62 <code class="structfield">indimmediate</code> <code class="type">bool</code>63 </p>64 <p>65 If true, the uniqueness check is enforced immediately on66 insertion67 (irrelevant if <code class="structfield">indisunique</code> is not true)68 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">69 <code class="structfield">indisclustered</code> <code class="type">bool</code>70 </p>71 <p>72 If true, the table was last clustered on this index73 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">74 <code class="structfield">indisvalid</code> <code class="type">bool</code>75 </p>76 <p>77 If true, the index is currently valid for queries. False means the78 index is possibly incomplete: it must still be modified by79 <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 safely80 be used for queries. If it is unique, the uniqueness property is not81 guaranteed true either.82 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">83 <code class="structfield">indcheckxmin</code> <code class="type">bool</code>84 </p>85 <p>86 If true, queries must not use the index until the <code class="structfield">xmin</code>87 of this <code class="structname">pg_index</code> row is below their <code class="symbol">TransactionXmin</code>88 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> with89 incompatible rows that they can see90 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">91 <code class="structfield">indisready</code> <code class="type">bool</code>92 </p>93 <p>94 If true, the index is currently ready for inserts. False means the95 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>96 operations.97 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">98 <code class="structfield">indislive</code> <code class="type">bool</code>99 </p>100 <p>101 If false, the index is in process of being dropped, and should be102 ignored for all purposes (including HOT-safety decisions)103 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">104 <code class="structfield">indisreplident</code> <code class="type">bool</code>105 </p>106 <p>107 If true this index has been chosen as <span class="quote">“<span class="quote">replica identity</span>”</span>108 using <a class="link" href="sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY"><code class="command">ALTER TABLE ...109 REPLICA IDENTITY USING INDEX ...</code></a>110 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">111 <code class="structfield">indkey</code> <code class="type">int2vector</code>112 (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>)113 </p>114 <p>115 This is an array of <code class="structfield">indnatts</code> values that116 indicate which table columns this index indexes. For example, a value117 of <code class="literal">1 3</code> would mean that the first and the third table118 columns make up the index entries. Key columns come before non-key119 (included) columns. A zero in this array indicates that the120 corresponding index attribute is an expression over the table columns,121 rather than a simple column reference.122 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">123 <code class="structfield">indcollation</code> <code class="type">oidvector</code>124 (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>)125 </p>126 <p>127 For each column in the index key128 (<code class="structfield">indnkeyatts</code> values), this contains the OID129 of the collation to use for the index, or zero if the column is not of130 a collatable data type.131 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">132 <code class="structfield">indclass</code> <code class="type">oidvector</code>133 (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>)134 </p>135 <p>136 For each column in the index key137 (<code class="structfield">indnkeyatts</code> values), this contains the OID138 of the operator class to use. See139 <a class="link" href="catalog-pg-opclass.html" title="53.33. pg_opclass"><code class="structname">pg_opclass</code></a> for details.140 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">141 <code class="structfield">indoption</code> <code class="type">int2vector</code>142 </p>143 <p>144 This is an array of <code class="structfield">indnkeyatts</code> values that145 store per-column flag bits. The meaning of the bits is defined by146 the index's access method.147 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">148 <code class="structfield">indexprs</code> <code class="type">pg_node_tree</code>149 </p>150 <p>151 Expression trees (in <code class="function">nodeToString()</code>152 representation) for index attributes that are not simple column153 references. This is a list with one element for each zero154 entry in <code class="structfield">indkey</code>. Null if all index attributes155 are simple references.156 </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">157 <code class="structfield">indpred</code> <code class="type">pg_node_tree</code>158 </p>159 <p>160 Expression tree (in <code class="function">nodeToString()</code>161 representation) for partial index predicate. Null if not a162 partial index.163 </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 16.3 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>