Hi, relscan.h is very widely used -- in particular it is included by some headers that want the IndexScanDesc and HeapScanDesc definitions in prototypes. However, most of the time they are just passing the struct through; they don't need to see the actual Heap/IndexScanDescData definitions.
I propose the following patch which moves the struct definitions to a separate new header relscan_internal.h. Files that actually need the definitions can include the new header. They are not that many -- I count 22 inclusions, all of them in .c files. Headers only include the .h file, which has the benefit that since it is a lean file, it needn't include all the other headers needed by the struct declaration. Zdenek says that this patch changes the number of times certain headers are opened (data gathered using dtrace): new old diff src/include/access/skey.h 347 465 -118 src/include/utils/rel.h 851 921 -70 src/include/access/relscan.h 340 360 -20 So it doesn't have a tremendous impact, but it does have some. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Index: contrib/pgrowlocks/pgrowlocks.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/contrib/pgrowlocks/pgrowlocks.c,v retrieving revision 1.10 diff -c -p -r1.10 pgrowlocks.c *** contrib/pgrowlocks/pgrowlocks.c 12 May 2008 00:00:43 -0000 1.10 --- contrib/pgrowlocks/pgrowlocks.c 9 Jun 2008 01:49:31 -0000 *************** *** 26,31 **** --- 26,32 ---- #include "access/heapam.h" #include "access/multixact.h" + #include "access/relscan_internal.h" #include "access/xact.h" #include "catalog/namespace.h" #include "funcapi.h" Index: contrib/pgstattuple/pgstattuple.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/contrib/pgstattuple/pgstattuple.c,v retrieving revision 1.35 diff -c -p -r1.35 pgstattuple.c *** contrib/pgstattuple/pgstattuple.c 16 May 2008 17:31:17 -0000 1.35 --- contrib/pgstattuple/pgstattuple.c 9 Jun 2008 01:49:44 -0000 *************** *** 29,34 **** --- 29,35 ---- #include "access/heapam.h" #include "access/htup.h" #include "access/nbtree.h" + #include "access/relscan_internal.h" #include "catalog/namespace.h" #include "funcapi.h" #include "miscadmin.h" Index: src/backend/access/gin/ginget.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/gin/ginget.c,v retrieving revision 1.16 diff -c -p -r1.16 ginget.c *** src/backend/access/gin/ginget.c 16 May 2008 16:31:01 -0000 1.16 --- src/backend/access/gin/ginget.c 8 Jun 2008 23:58:24 -0000 *************** *** 15,20 **** --- 15,21 ---- #include "postgres.h" #include "access/gin.h" + #include "access/relscan_internal.h" #include "catalog/index.h" #include "miscadmin.h" #include "storage/bufmgr.h" Index: src/backend/access/gin/ginscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/gin/ginscan.c,v retrieving revision 1.14 diff -c -p -r1.14 ginscan.c *** src/backend/access/gin/ginscan.c 16 May 2008 16:31:01 -0000 1.14 --- src/backend/access/gin/ginscan.c 8 Jun 2008 23:59:31 -0000 *************** *** 16,21 **** --- 16,22 ---- #include "access/genam.h" #include "access/gin.h" + #include "access/relscan_internal.h" #include "pgstat.h" #include "storage/bufmgr.h" #include "utils/memutils.h" Index: src/backend/access/gist/gistget.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/gist/gistget.c,v retrieving revision 1.73 diff -c -p -r1.73 gistget.c *** src/backend/access/gist/gistget.c 12 May 2008 00:00:44 -0000 1.73 --- src/backend/access/gist/gistget.c 8 Jun 2008 23:55:58 -0000 *************** *** 15,20 **** --- 15,21 ---- #include "postgres.h" #include "access/gist_private.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "miscadmin.h" #include "pgstat.h" Index: src/backend/access/gist/gistscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/gist/gistscan.c,v retrieving revision 1.69 diff -c -p -r1.69 gistscan.c *** src/backend/access/gist/gistscan.c 12 May 2008 00:00:44 -0000 1.69 --- src/backend/access/gist/gistscan.c 8 Jun 2008 23:56:23 -0000 *************** *** 17,22 **** --- 17,23 ---- #include "access/genam.h" #include "access/gist_private.h" #include "access/gistscan.h" + #include "access/relscan_internal.h" #include "storage/bufmgr.h" #include "utils/memutils.h" Index: src/backend/access/hash/hash.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/hash/hash.c,v retrieving revision 1.103 diff -c -p -r1.103 hash.c *** src/backend/access/hash/hash.c 12 May 2008 00:00:44 -0000 1.103 --- src/backend/access/hash/hash.c 8 Jun 2008 23:56:35 -0000 *************** *** 20,25 **** --- 20,26 ---- #include "access/genam.h" #include "access/hash.h" + #include "access/relscan_internal.h" #include "catalog/index.h" #include "commands/vacuum.h" #include "miscadmin.h" Index: src/backend/access/hash/hashscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/hash/hashscan.c,v retrieving revision 1.44 diff -c -p -r1.44 hashscan.c *** src/backend/access/hash/hashscan.c 7 Mar 2008 15:59:03 -0000 1.44 --- src/backend/access/hash/hashscan.c 8 Jun 2008 23:57:42 -0000 *************** *** 16,21 **** --- 16,22 ---- #include "postgres.h" #include "access/hash.h" + #include "access/relscan_internal.h" #include "utils/memutils.h" #include "utils/resowner.h" Index: src/backend/access/hash/hashsearch.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/hash/hashsearch.c,v retrieving revision 1.52 diff -c -p -r1.52 hashsearch.c *** src/backend/access/hash/hashsearch.c 12 May 2008 00:00:44 -0000 1.52 --- src/backend/access/hash/hashsearch.c 8 Jun 2008 23:57:48 -0000 *************** *** 15,20 **** --- 15,21 ---- #include "postgres.h" #include "access/hash.h" + #include "access/relscan_internal.h" #include "pgstat.h" #include "storage/bufmgr.h" Index: src/backend/access/hash/hashutil.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/hash/hashutil.c,v retrieving revision 1.54 diff -c -p -r1.54 hashutil.c *** src/backend/access/hash/hashutil.c 12 May 2008 00:00:44 -0000 1.54 --- src/backend/access/hash/hashutil.c 8 Jun 2008 23:58:00 -0000 *************** *** 17,22 **** --- 17,23 ---- #include "access/genam.h" #include "access/hash.h" #include "access/reloptions.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "storage/bufmgr.h" #include "utils/lsyscache.h" Index: src/backend/access/heap/heapam.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/heap/heapam.c,v retrieving revision 1.258 diff -c -p -r1.258 heapam.c *** src/backend/access/heap/heapam.c 8 Jun 2008 22:00:47 -0000 1.258 --- src/backend/access/heap/heapam.c 8 Jun 2008 23:57:30 -0000 *************** *** 42,47 **** --- 42,48 ---- #include "access/heapam.h" #include "access/hio.h" #include "access/multixact.h" + #include "access/relscan_internal.h" #include "access/sysattr.h" #include "access/transam.h" #include "access/tuptoaster.h" Index: src/backend/access/index/genam.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/index/genam.c,v retrieving revision 1.70 diff -c -p -r1.70 genam.c *** src/backend/access/index/genam.c 8 Jun 2008 23:16:43 -0000 1.70 --- src/backend/access/index/genam.c 8 Jun 2008 23:59:01 -0000 *************** *** 21,26 **** --- 21,27 ---- #include "access/genam.h" #include "access/heapam.h" + #include "access/relscan_internal.h" #include "access/transam.h" #include "miscadmin.h" #include "pgstat.h" Index: src/backend/access/index/indexam.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/index/indexam.c,v retrieving revision 1.108 diff -c -p -r1.108 indexam.c *** src/backend/access/index/indexam.c 12 May 2008 00:00:45 -0000 1.108 --- src/backend/access/index/indexam.c 8 Jun 2008 23:58:51 -0000 *************** *** 64,69 **** --- 64,70 ---- #include "access/genam.h" #include "access/heapam.h" + #include "access/relscan_internal.h" #include "access/transam.h" #include "pgstat.h" #include "storage/bufmgr.h" Index: src/backend/access/nbtree/nbtree.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/nbtree/nbtree.c,v retrieving revision 1.160 diff -c -p -r1.160 nbtree.c *** src/backend/access/nbtree/nbtree.c 12 May 2008 00:00:45 -0000 1.160 --- src/backend/access/nbtree/nbtree.c 8 Jun 2008 23:57:05 -0000 *************** *** 20,25 **** --- 20,26 ---- #include "access/genam.h" #include "access/nbtree.h" + #include "access/relscan_internal.h" #include "catalog/index.h" #include "commands/vacuum.h" #include "miscadmin.h" Index: src/backend/access/nbtree/nbtsearch.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/nbtree/nbtsearch.c,v retrieving revision 1.117 diff -c -p -r1.117 nbtsearch.c *** src/backend/access/nbtree/nbtsearch.c 12 May 2008 00:00:45 -0000 1.117 --- src/backend/access/nbtree/nbtsearch.c 8 Jun 2008 23:56:52 -0000 *************** *** 17,22 **** --- 17,23 ---- #include "access/genam.h" #include "access/nbtree.h" + #include "access/relscan_internal.h" #include "pgstat.h" #include "storage/bufmgr.h" #include "utils/lsyscache.h" Index: src/backend/access/nbtree/nbtutils.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/nbtree/nbtutils.c,v retrieving revision 1.90 diff -c -p -r1.90 nbtutils.c *** src/backend/access/nbtree/nbtutils.c 12 May 2008 00:00:45 -0000 1.90 --- src/backend/access/nbtree/nbtutils.c 8 Jun 2008 23:56:44 -0000 *************** *** 20,25 **** --- 20,26 ---- #include "access/genam.h" #include "access/nbtree.h" #include "access/reloptions.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "miscadmin.h" #include "storage/bufmgr.h" Index: src/backend/catalog/index.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/catalog/index.c,v retrieving revision 1.299 diff -c -p -r1.299 index.c *** src/backend/catalog/index.c 12 May 2008 20:01:59 -0000 1.299 --- src/backend/catalog/index.c 8 Jun 2008 23:56:08 -0000 *************** *** 25,30 **** --- 25,31 ---- #include "access/genam.h" #include "access/heapam.h" + #include "access/relscan_internal.h" #include "access/sysattr.h" #include "access/transam.h" #include "access/xact.h" Index: src/backend/commands/cluster.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/cluster.c,v retrieving revision 1.176 diff -c -p -r1.176 cluster.c *** src/backend/commands/cluster.c 12 May 2008 20:01:59 -0000 1.176 --- src/backend/commands/cluster.c 8 Jun 2008 23:58:15 -0000 *************** *** 20,25 **** --- 20,26 ---- #include "access/genam.h" #include "access/heapam.h" #include "access/rewriteheap.h" + #include "access/relscan_internal.h" #include "access/transam.h" #include "access/xact.h" #include "catalog/catalog.h" Index: src/backend/commands/tablecmds.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/tablecmds.c,v retrieving revision 1.255 diff -c -p -r1.255 tablecmds.c *** src/backend/commands/tablecmds.c 19 May 2008 04:14:24 -0000 1.255 --- src/backend/commands/tablecmds.c 8 Jun 2008 23:59:19 -0000 *************** *** 17,22 **** --- 17,23 ---- #include "access/genam.h" #include "access/heapam.h" #include "access/reloptions.h" + #include "access/relscan_internal.h" #include "access/sysattr.h" #include "access/xact.h" #include "catalog/catalog.h" Index: src/backend/executor/nodeBitmapHeapscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/executor/nodeBitmapHeapscan.c,v retrieving revision 1.28 diff -c -p -r1.28 nodeBitmapHeapscan.c *** src/backend/executor/nodeBitmapHeapscan.c 13 May 2008 15:44:08 -0000 1.28 --- src/backend/executor/nodeBitmapHeapscan.c 8 Jun 2008 23:58:34 -0000 *************** *** 36,41 **** --- 36,42 ---- #include "postgres.h" #include "access/heapam.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "executor/nodeBitmapHeapscan.h" #include "pgstat.h" Index: src/backend/executor/nodeIndexscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/executor/nodeIndexscan.c,v retrieving revision 1.128 diff -c -p -r1.128 nodeIndexscan.c *** src/backend/executor/nodeIndexscan.c 13 Apr 2008 20:51:20 -0000 1.128 --- src/backend/executor/nodeIndexscan.c 8 Jun 2008 23:59:49 -0000 *************** *** 26,31 **** --- 26,32 ---- #include "access/genam.h" #include "access/nbtree.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "executor/nodeIndexscan.h" #include "nodes/nodeFuncs.h" Index: src/backend/executor/nodeSeqscan.c =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/executor/nodeSeqscan.c,v retrieving revision 1.64 diff -c -p -r1.64 nodeSeqscan.c *** src/backend/executor/nodeSeqscan.c 1 Jan 2008 19:45:49 -0000 1.64 --- src/backend/executor/nodeSeqscan.c 8 Jun 2008 23:59:56 -0000 *************** *** 25,30 **** --- 25,31 ---- #include "postgres.h" #include "access/heapam.h" + #include "access/relscan_internal.h" #include "executor/execdebug.h" #include "executor/nodeSeqscan.h" Index: src/include/access/genam.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/genam.h,v retrieving revision 1.73 diff -c -p -r1.73 genam.h *** src/include/access/genam.h 8 Jun 2008 22:41:04 -0000 1.73 --- src/include/access/genam.h 9 Jun 2008 00:11:27 -0000 *************** *** 14,25 **** --- 14,28 ---- #ifndef GENAM_H #define GENAM_H + #include "access/htup.h" #include "access/relscan.h" #include "access/sdir.h" + #include "access/skey.h" #include "nodes/tidbitmap.h" #include "storage/buf.h" #include "storage/lock.h" #include "utils/rel.h" + #include "utils/snapshot.h" /* * Struct for statistics returned by ambuild Index: src/include/access/gin.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/gin.h,v retrieving revision 1.21 diff -c -p -r1.21 gin.h *** src/include/access/gin.h 6 Jun 2008 22:35:22 -0000 1.21 --- src/include/access/gin.h 9 Jun 2008 00:13:12 -0000 *************** *** 14,19 **** --- 14,20 ---- #include "access/itup.h" #include "access/relscan.h" + #include "access/skey.h" #include "access/xlog.h" #include "fmgr.h" #include "nodes/tidbitmap.h" *************** *** 21,26 **** --- 22,28 ---- #include "storage/buf.h" #include "storage/off.h" #include "storage/relfilenode.h" + #include "utils/rel.h" /* Index: src/include/access/hash.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/hash.h,v retrieving revision 1.87 diff -c -p -r1.87 hash.h *** src/include/access/hash.h 10 Apr 2008 22:25:25 -0000 1.87 --- src/include/access/hash.h 9 Jun 2008 00:12:00 -0000 *************** *** 23,28 **** --- 23,29 ---- #include "access/xlog.h" #include "fmgr.h" #include "storage/lock.h" + #include "utils/rel.h" /* * Mapping from hash bucket number to physical block number of bucket's Index: src/include/access/heapam.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/heapam.h,v retrieving revision 1.135 diff -c -p -r1.135 heapam.h *** src/include/access/heapam.h 6 Jun 2008 22:35:22 -0000 1.135 --- src/include/access/heapam.h 9 Jun 2008 00:05:56 -0000 *************** *** 17,25 **** --- 17,28 ---- #include "access/htup.h" #include "access/relscan.h" #include "access/sdir.h" + #include "access/skey.h" #include "access/xlog.h" #include "nodes/primnodes.h" + #include "storage/bufpage.h" #include "storage/lock.h" + #include "utils/rel.h" #include "utils/snapshot.h" Index: src/include/access/nbtree.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/nbtree.h,v retrieving revision 1.119 diff -c -p -r1.119 nbtree.h *** src/include/access/nbtree.h 6 Jun 2008 22:35:22 -0000 1.119 --- src/include/access/nbtree.h 9 Jun 2008 00:16:09 -0000 *************** *** 17,22 **** --- 17,23 ---- #include "access/itup.h" #include "access/relscan.h" #include "access/sdir.h" + #include "access/skey.h" #include "access/xlog.h" #include "access/xlogutils.h" Index: src/include/access/relscan.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/access/relscan.h,v retrieving revision 1.65 diff -c -p -r1.65 relscan.h *** src/include/access/relscan.h 12 May 2008 00:00:53 -0000 1.65 --- src/include/access/relscan.h 9 Jun 2008 00:33:48 -0000 *************** *** 14,95 **** #ifndef RELSCAN_H #define RELSCAN_H - #include "access/htup.h" - #include "access/skey.h" - #include "storage/bufpage.h" - #include "utils/rel.h" - #include "utils/snapshot.h" - - - typedef struct HeapScanDescData - { - /* scan parameters */ - Relation rs_rd; /* heap relation descriptor */ - Snapshot rs_snapshot; /* snapshot to see */ - int rs_nkeys; /* number of scan keys */ - ScanKey rs_key; /* array of scan key descriptors */ - bool rs_bitmapscan; /* true if this is really a bitmap scan */ - bool rs_pageatatime; /* verify visibility page-at-a-time? */ - bool rs_allow_strat; /* allow or disallow use of access strategy */ - bool rs_allow_sync; /* allow or disallow use of syncscan */ - - /* state set up at initscan time */ - BlockNumber rs_nblocks; /* number of blocks to scan */ - BlockNumber rs_startblock; /* block # to start at */ - BufferAccessStrategy rs_strategy; /* access strategy for reads */ - bool rs_syncscan; /* report location to syncscan logic? */ - - /* scan current state */ - bool rs_inited; /* false = scan not init'd yet */ - HeapTupleData rs_ctup; /* current tuple in scan, if any */ - BlockNumber rs_cblock; /* current block # in scan, if any */ - Buffer rs_cbuf; /* current buffer in scan, if any */ - /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ - ItemPointerData rs_mctid; /* marked scan position, if any */ - - /* these fields only used in page-at-a-time mode and for bitmap scans */ - int rs_cindex; /* current tuple's index in vistuples */ - int rs_mindex; /* marked tuple's saved index */ - int rs_ntuples; /* number of visible tuples on page */ - OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ - } HeapScanDescData; ! typedef HeapScanDescData *HeapScanDesc; ! /* ! * We use the same IndexScanDescData structure for both amgettuple-based ! * and amgetbitmap-based index scans. Some fields are only relevant in ! * amgettuple-based scans. ! */ ! typedef struct IndexScanDescData ! { ! /* scan parameters */ ! Relation heapRelation; /* heap relation descriptor, or NULL */ ! Relation indexRelation; /* index relation descriptor */ ! Snapshot xs_snapshot; /* snapshot to see */ ! int numberOfKeys; /* number of scan keys */ ! ScanKey keyData; /* array of scan key descriptors */ ! ! /* signaling to index AM about killing index tuples */ ! bool kill_prior_tuple; /* last-returned tuple is dead */ ! bool ignore_killed_tuples; /* do not return killed entries */ ! ! /* index access method's private state */ ! void *opaque; /* access-method-specific info */ ! ! /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */ ! HeapTupleData xs_ctup; /* current heap tuple, if any */ ! Buffer xs_cbuf; /* current heap buffer in scan, if any */ ! /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ ! bool xs_recheck; /* T means scan keys must be rechecked */ ! ! /* state data for traversing HOT chains in index_getnext */ ! bool xs_hot_dead; /* T if all members of HOT chain are dead */ ! OffsetNumber xs_next_hot; /* next member of HOT chain, if any */ ! TransactionId xs_prev_xmax; /* previous HOT chain member's XMAX, if any */ ! } IndexScanDescData; ! ! typedef IndexScanDescData *IndexScanDesc; /* --- 14,24 ---- #ifndef RELSCAN_H #define RELSCAN_H ! /* struct definitions appear in relscan_internal.h */ ! typedef struct HeapScanDescData *HeapScanDesc; ! typedef struct IndexScanDescData *IndexScanDesc; /* Index: src/include/nodes/execnodes.h =================================================================== RCS file: /home/alvherre/Code/cvs/pgsql/src/include/nodes/execnodes.h,v retrieving revision 1.183 diff -c -p -r1.183 execnodes.h *** src/include/nodes/execnodes.h 1 Jan 2008 19:45:58 -0000 1.183 --- src/include/nodes/execnodes.h 9 Jun 2008 00:04:30 -0000 *************** *** 15,24 **** --- 15,27 ---- #define EXECNODES_H #include "access/relscan.h" + #include "access/skey.h" #include "nodes/params.h" #include "nodes/plannodes.h" #include "nodes/tidbitmap.h" #include "utils/hsearch.h" + #include "utils/rel.h" + #include "utils/snapshot.h" #include "utils/tuplestore.h"
/*------------------------------------------------------------------------- * * relscan_internal.h * POSTGRES relation scan descriptor definitions. * * * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $PostgreSQL$ * *------------------------------------------------------------------------- */ #ifndef RELSCAN_INTERNAL_H #define RELSCAN_INTERNAL_H #include "access/htup.h" #include "access/relscan.h" #include "access/skey.h" #include "storage/bufpage.h" #include "utils/rel.h" #include "utils/snapshot.h" /* the typedefs appear in relscan.h */ typedef struct HeapScanDescData { /* scan parameters */ Relation rs_rd; /* heap relation descriptor */ Snapshot rs_snapshot; /* snapshot to see */ int rs_nkeys; /* number of scan keys */ ScanKey rs_key; /* array of scan key descriptors */ bool rs_bitmapscan; /* true if this is really a bitmap scan */ bool rs_pageatatime; /* verify visibility page-at-a-time? */ bool rs_allow_strat; /* allow or disallow use of access strategy */ bool rs_allow_sync; /* allow or disallow use of syncscan */ /* state set up at initscan time */ BlockNumber rs_nblocks; /* number of blocks to scan */ BlockNumber rs_startblock; /* block # to start at */ BufferAccessStrategy rs_strategy; /* access strategy for reads */ bool rs_syncscan; /* report location to syncscan logic? */ /* scan current state */ bool rs_inited; /* false = scan not init'd yet */ HeapTupleData rs_ctup; /* current tuple in scan, if any */ BlockNumber rs_cblock; /* current block # in scan, if any */ Buffer rs_cbuf; /* current buffer in scan, if any */ /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ ItemPointerData rs_mctid; /* marked scan position, if any */ /* these fields only used in page-at-a-time mode and for bitmap scans */ int rs_cindex; /* current tuple's index in vistuples */ int rs_mindex; /* marked tuple's saved index */ int rs_ntuples; /* number of visible tuples on page */ OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ } HeapScanDescData; /* * We use the same IndexScanDescData structure for both amgettuple-based * and amgetbitmap-based index scans. Some fields are only relevant in * amgettuple-based scans. */ typedef struct IndexScanDescData { /* scan parameters */ Relation heapRelation; /* heap relation descriptor, or NULL */ Relation indexRelation; /* index relation descriptor */ Snapshot xs_snapshot; /* snapshot to see */ int numberOfKeys; /* number of scan keys */ ScanKey keyData; /* array of scan key descriptors */ /* signaling to index AM about killing index tuples */ bool kill_prior_tuple; /* last-returned tuple is dead */ bool ignore_killed_tuples; /* do not return killed entries */ /* index access method's private state */ void *opaque; /* access-method-specific info */ /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */ HeapTupleData xs_ctup; /* current heap tuple, if any */ Buffer xs_cbuf; /* current heap buffer in scan, if any */ /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ bool xs_recheck; /* T means scan keys must be rechecked */ /* state data for traversing HOT chains in index_getnext */ bool xs_hot_dead; /* T if all members of HOT chain are dead */ OffsetNumber xs_next_hot; /* next member of HOT chain, if any */ TransactionId xs_prev_xmax; /* previous HOT chain member's XMAX, if any */ } IndexScanDescData; #endif /* RELSCAN_INTERNAL_H */
-- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches