HOT updates. When we update a tuple without changing any of its indexed

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 282d2a03dd30804b01f8042f640d638c2ee76604
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-09-20T17:56:33Z
Releases: 8.3.0
HOT updates.  When we update a tuple without changing any of its indexed
columns, and the new version can be stored on the same heap page, we no longer
generate extra index entries for the new version.  Instead, index searches
follow the HOT-chain links to ensure they find the correct tuple version.

In addition, this patch introduces the ability to "prune" dead tuples on a
per-page basis, without having to do a complete VACUUM pass to recover space.
VACUUM is still needed to clean up dead index entries, however.

Pavan Deolasee, with help from a bunch of other people.

Files

PathChange+/−
contrib/pgstattuple/pgstattuple.c modified +3 −3
doc/src/sgml/catalogs.sgml modified +24 −1
doc/src/sgml/monitoring.sgml modified +40 −2
doc/src/sgml/ref/create_index.sgml modified +5 −2
src/backend/access/gin/ginentrypage.c modified +5 −5
src/backend/access/gin/ginvacuum.c modified +2 −2
src/backend/access/gin/ginxlog.c modified +5 −5
src/backend/access/gist/gist.c modified +2 −2
src/backend/access/gist/gistutil.c modified +2 −2
src/backend/access/gist/gistvacuum.c modified +2 −2
src/backend/access/hash/hashinsert.c modified +2 −2
src/backend/access/hash/hashovfl.c modified +2 −2
src/backend/access/hash/hashpage.c modified +2 −2
src/backend/access/heap/heapam.c modified +571 −69
src/backend/access/heap/hio.c modified +4 −4
src/backend/access/heap/Makefile modified +2 −2
src/backend/access/heap/pruneheap.c added +702 −0
src/backend/access/heap/README.HOT added +489 −0
src/backend/access/heap/rewriteheap.c modified +5 −3
src/backend/access/index/genam.c modified +5 −1
src/backend/access/index/indexam.c modified +213 −46
src/backend/access/nbtree/nbtinsert.c modified +40 −41
src/backend/access/nbtree/nbtsort.c modified +2 −2
src/backend/access/nbtree/nbtxlog.c modified +6 −6
src/backend/catalog/index.c modified +281 −67
src/backend/catalog/indexing.c modified +9 −1
src/backend/catalog/system_views.sql modified +2 −1
src/backend/catalog/toasting.c modified +3 −1
src/backend/commands/indexcmds.c modified +120 −13
src/backend/commands/sequence.c modified +2 −2
src/backend/commands/vacuum.c modified +210 −35
src/backend/commands/vacuumlazy.c modified +81 −28
src/backend/executor/execMain.c modified +4 −2
src/backend/executor/execUtils.c modified +9 −1
src/backend/executor/nodeBitmapHeapscan.c modified +41 −59
src/backend/executor/spi.c modified +3 −1
src/backend/nodes/tidbitmap.c modified +3 −4
src/backend/optimizer/plan/planner.c modified +3 −1
src/backend/optimizer/util/plancat.c modified +16 −1
src/backend/optimizer/util/var.c modified +44 −1
src/backend/postmaster/pgstat.c modified +27 −2
src/backend/storage/buffer/bufmgr.c modified +50 −1
src/backend/storage/page/bufpage.c modified +94 −18
src/backend/utils/adt/pgstatfuncs.c modified +18 −1
src/backend/utils/cache/plancache.c modified +41 −1
src/backend/utils/cache/relcache.c modified +95 −1
src/include/access/heapam.h modified +18 −3
src/include/access/htup.h modified +107 −21
src/include/access/relscan.h modified +4 −1
src/include/catalog/catversion.h modified +2 −2
src/include/catalog/pg_attribute.h modified +8 −6
src/include/catalog/pg_index.h modified +11 −7
src/include/catalog/pg_proc.h modified +3 −1
src/include/nodes/execnodes.h modified +8 −1
src/include/nodes/plannodes.h modified +3 −1
src/include/nodes/relation.h modified +3 −1
src/include/optimizer/var.h modified +2 −1
src/include/pgstat.h modified +8 −5
src/include/storage/bufmgr.h modified +2 −1
src/include/storage/bufpage.h modified +30 −4
src/include/utils/plancache.h modified +3 −1
src/include/utils/relcache.h modified +2 −1
src/include/utils/rel.h modified +3 −1
src/test/regress/expected/create_index.out modified +1 −0
src/test/regress/expected/rules.out modified +3 −3