@@ -1075,4 +1075,74 @@ data. Empty in ordinary tables.</entry>
1075
1075
</sect2>
1076
1076
</sect1>
1077
1077
1078
+ <sect1 id="storage-hot">
1079
+
1080
+ <title>Heap-Only Tuples (<acronym>HOT</acronym>)</title>
1081
+
1082
+ <para>
1083
+ To allow for high concurrency, <productname>PostgreSQL</productname>
1084
+ uses <link linkend="mvcc-intro">multiversion concurrency
1085
+ control</link> (<acronym>MVCC</acronym>) to store rows. However,
1086
+ <acronym>MVCC</acronym> has some downsides for update queries.
1087
+ Specifically, updates require new versions of rows to be added to
1088
+ tables. This can also require new index entries for each updated row,
1089
+ and removal of old versions of rows and their index entries can be
1090
+ expensive.
1091
+ </para>
1092
+
1093
+ <para>
1094
+ To help reduce the overhead of updates,
1095
+ <productname>PostgreSQL</productname> has an optimization called
1096
+ heap-only tuples (<acronym>HOT</acronym>). This optimization is
1097
+ possible when:
1098
+
1099
+ <itemizedlist>
1100
+ <listitem>
1101
+ <para>
1102
+ The update does not modify any columns referenced by the table's
1103
+ indexes, including expression and partial indexes.
1104
+ </para>
1105
+ </listitem>
1106
+ <listitem>
1107
+ <para>
1108
+ There is sufficient free space on the page containing the old row
1109
+ for the updated row.
1110
+ </para>
1111
+ </listitem>
1112
+ </itemizedlist>
1113
+
1114
+ In such cases, heap-only tuples provide two optimizations:
1115
+
1116
+ <itemizedlist>
1117
+ <listitem>
1118
+ <para>
1119
+ New index entries are not needed to represent updated rows.
1120
+ </para>
1121
+ </listitem>
1122
+ <listitem>
1123
+ <para>
1124
+ Old versions of updated rows can be completely removed during normal
1125
+ operation, including <command>SELECT</command>s, instead of requiring
1126
+ periodic vacuum operations. (This is possible because indexes
1127
+ do not reference their <link linkend="storage-page-layout">page
1128
+ item identifiers</link>.)
1129
+ </para>
1130
+ </listitem>
1131
+ </itemizedlist>
1132
+ </para>
1133
+
1134
+ <para>
1135
+ In summary, heap-only tuple updates can only be created
1136
+ if columns used by indexes are not updated. You can
1137
+ increase the likelihood of sufficient page space for
1138
+ <acronym>HOT</acronym> updates by decreasing a table's <link
1139
+ linkend="sql-createtable"><literal>fillfactor</literal></link>.
1140
+ If you don't, <acronym>HOT</acronym> updates will still happen because
1141
+ new rows will naturally migrate to new pages and existing pages with
1142
+ sufficient free space for new row versions. The system view <link
1143
+ linkend="monitoring-pg-stat-all-tables-view">pg_stat_all_tables</link>
1144
+ allows monitoring of the occurrence of HOT and non-HOT updates.
1145
+ </para>
1146
+ </sect1>
1147
+
1078
1148
</chapter>
0 commit comments