Restructure index AM interface for index building and index tuple deletion,

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

Commit: c8076f09d2eb82a28f27f97230be470fffe7a1e0
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2001-07-15T22:48:19Z
Releases: 7.2.1
Restructure index AM interface for index building and index tuple deletion,
per previous discussion on pghackers.  Most of the duplicate code in
different AMs' ambuild routines has been moved out to a common routine
in index.c; this means that all index types now do the right things about
inserting recently-dead tuples, etc.  (I also removed support for EXTEND
INDEX in the ambuild routines, since that's about to go away anyway, and
it cluttered the code a lot.)  The retail indextuple deletion routines have
been replaced by a "bulk delete" routine in which the indexscan is inside
the access method.  I haven't pushed this change as far as it should go yet,
but it should allow considerable simplification of the internal bookkeeping
for deletions.  Also, add flag columns to pg_am to eliminate various
hardcoded tests on AM OIDs, and remove unused pg_am columns.

Fix rtree and gist index types to not attempt to store NULLs; before this,
gist usually crashed, while rtree managed not to crash but computed wacko
bounding boxes for NULL entries (which might have had something to do with
the performance problems we've heard about occasionally).

Add AtEOXact routines to hash, rtree, and gist, all of which have static
state that needs to be reset after an error.  We discovered this need long
ago for btree, but missed the other guys.

Oh, one more thing: concurrent VACUUM is now the default.

Files

PathChange+/−
doc/src/sgml/catalogs.sgml modified +3 −2
src/backend/access/common/indexvalid.c modified +14 −23
src/backend/access/gist/gist.c modified +210 −198
src/backend/access/gist/gistscan.c modified +23 −7
src/backend/access/hash/hash.c modified +148 −169
src/backend/access/hash/hashovfl.c modified +23 −23
src/backend/access/hash/hashpage.c modified +36 −13
src/backend/access/hash/hashscan.c modified +26 −1
src/backend/access/index/indexam.c modified +33 −27
src/backend/access/nbtree/Makefile modified +2 −2
src/backend/access/nbtree/nbtinsert.c modified +30 −33
src/backend/access/nbtree/nbtpage.c modified +20 −21
src/backend/access/nbtree/nbtree.c modified +252 −252
src/backend/access/nbtree/nbtscan.c deleted +0 −224
src/backend/access/nbtree/nbtsearch.c modified +13 −13
src/backend/access/nbtree/README modified +6 −10
src/backend/access/rtree/rtree.c modified +167 −176
src/backend/access/rtree/rtscan.c modified +23 −7
src/backend/access/transam/xact.c modified +10 −1
src/backend/bootstrap/bootstrap.c modified +2 −2
src/backend/catalog/heap.c modified +2 −2
src/backend/catalog/index.c modified +178 −143
src/backend/catalog/pg_operator.c modified +2 −2
src/backend/commands/command.c modified +2 −2
src/backend/commands/indexcmds.c modified +26 −18
src/backend/commands/vacuum.c modified +40 −69
src/backend/commands/vacuumlazy.c modified +29 −50
src/backend/executor/execUtils.c modified +23 −25
src/backend/executor/nodeIndexscan.c modified +3 −3
src/backend/executor/nodeSeqscan.c modified +2 −2
src/backend/optimizer/util/plancat.c modified +2 −2
src/backend/utils/adt/datum.c modified +2 −2
src/bin/initdb/initdb.sh modified +3 −3
src/include/access/genam.h modified +18 −3
src/include/access/gist.h modified +2 −2
src/include/access/gistscan.h modified +2 −1
src/include/access/hash.h modified +4 −13
src/include/access/nbtree.h modified +6 −12
src/include/access/rtree.h modified +3 −2
src/include/catalog/catversion.h modified +2 −2
src/include/catalog/index.h modified +18 −2
src/include/catalog/pg_am.h modified +31 −41
src/include/catalog/pg_index.h modified +4 −2
src/include/catalog/pg_proc.h modified +22 −23
src/test/regress/expected/oidjoins.out modified +8 −8
src/test/regress/expected/opr_sanity.out modified +2 −2
src/test/regress/sql/oidjoins.sql modified +4 −4