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