]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/storage-hot.html
WIP: toc builder
[ai-pg] / full-docs / src / sgml / html / storage-hot.html
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>66.7. Heap-Only Tuples (HOT)</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="storage-page-layout.html" title="66.6. Database Page Layout" /><link rel="next" href="transactions.html" title="Chapter 67. Transaction Processing" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">66.7. Heap-Only Tuples (<acronym class="acronym">HOT</acronym>)</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="storage-page-layout.html" title="66.6. Database Page Layout">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="storage.html" title="Chapter 66. Database Physical Storage">Up</a></td><th width="60%" align="center">Chapter 66. Database Physical Storage</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="transactions.html" title="Chapter 67. Transaction Processing">Next</a></td></tr></table><hr /></div><div class="sect1" id="STORAGE-HOT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">66.7. Heap-Only Tuples (<acronym class="acronym">HOT</acronym>) <a href="#STORAGE-HOT" class="id_link">#</a></h2></div></div></div><p>
3   To allow for high concurrency, <span class="productname">PostgreSQL</span>
4   uses <a class="link" href="mvcc-intro.html" title="13.1. Introduction">multiversion concurrency
5   control</a> (<acronym class="acronym">MVCC</acronym>) to store rows.  However,
6   <acronym class="acronym">MVCC</acronym> has some downsides for update queries.
7   Specifically, updates require new versions of rows to be added to
8   tables.  This can also require new index entries for each updated row,
9   and removal of old versions of rows and their index entries can be
10   expensive.
11  </p><p>
12   To help reduce the overhead of updates,
13   <span class="productname">PostgreSQL</span> has an optimization called
14   heap-only tuples (<acronym class="acronym">HOT</acronym>).  This optimization is
15   possible when:
16
17   </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
18      The update does not modify any columns referenced by the table's indexes,
19      not including summarizing indexes.  The only summarizing index method in
20      the core <span class="productname">PostgreSQL</span> distribution is <a class="link" href="brin.html" title="65.5. BRIN Indexes">BRIN</a>.
21      </p></li><li class="listitem"><p>
22      There is sufficient free space on the page containing the old row
23      for the updated row.
24     </p></li></ul></div><p>
25
26   In such cases, heap-only tuples provide two optimizations:
27
28   </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
29      New index entries are not needed to represent updated rows, however,
30      summary indexes may still need to be updated.
31     </p></li><li class="listitem"><p>
32      When a row is updated multiple times, row versions other than the oldest
33      and the newest can be completely removed during normal operation,
34      including <code class="command">SELECT</code>s, instead of requiring periodic vacuum
35      operations.  (Indexes always refer to the
36      <a class="link" href="storage-page-layout.html" title="66.6. Database Page Layout">page item identifier</a> of the
37      original row version. The tuple data associated with that row version
38      is removed, and its item identifier is converted to a redirect that
39      points to the oldest version that may still be visible to some concurrent
40      transaction. Intermediate row versions that are no longer visible to
41      anyone are completely removed, and the associated page item identifiers
42      are made available for reuse.)
43     </p></li></ul></div><p>
44  </p><p>
45   You can increase the likelihood of sufficient page space for
46   <acronym class="acronym">HOT</acronym> updates by decreasing a table's <a class="link" href="sql-createtable.html#RELOPTION-FILLFACTOR"><code class="literal">fillfactor</code></a>.  If you
47   don't, <acronym class="acronym">HOT</acronym> updates will still happen because new rows
48   will naturally migrate to new pages and existing pages with sufficient free
49   space for new row versions.  The system view <a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW" title="27.2.19. pg_stat_all_tables">pg_stat_all_tables</a>
50   allows monitoring of the occurrence of HOT and non-HOT updates.
51  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="storage-page-layout.html" title="66.6. Database Page Layout">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="storage.html" title="Chapter 66. Database Physical Storage">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="transactions.html" title="Chapter 67. Transaction Processing">Next</a></td></tr><tr><td width="40%" align="left" valign="top">66.6. Database Page Layout </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> Chapter 67. Transaction Processing</td></tr></table></div></body></html>