From 2a8d3d83efeafe7f5d7ba2e56d165f2cc78a7d56 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 7 Nov 2005 17:36:47 +0000 Subject: R-tree is dead ... long live GiST. --- src/include/access/gist.h | 23 ++++++- src/include/access/rmgr.h | 3 +- src/include/access/rtree.h | 145 -------------------------------------------- src/include/access/rtscan.h | 23 ------- 4 files changed, 21 insertions(+), 173 deletions(-) delete mode 100644 src/include/access/rtree.h delete mode 100644 src/include/access/rtscan.h (limited to 'src/include/access') diff --git a/src/include/access/gist.h b/src/include/access/gist.h index 22c897959f..b48c492f7f 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -9,18 +9,18 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/gist.h,v 1.50 2005/10/15 02:49:42 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/gist.h,v 1.51 2005/11/07 17:36:46 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef GIST_H #define GIST_H +#include "access/xlog.h" +#include "access/xlogdefs.h" #include "storage/bufpage.h" #include "storage/off.h" #include "utils/rel.h" -#include "access/xlog.h" -#include "access/xlogdefs.h" /* * amproc indexes for GiST indexes. @@ -34,6 +34,23 @@ #define GIST_EQUAL_PROC 7 #define GISTNProcs 7 +/* + * strategy numbers for GiST opclasses that want to implement the old + * RTREE behavior. + */ +#define RTLeftStrategyNumber 1 +#define RTOverLeftStrategyNumber 2 +#define RTOverlapStrategyNumber 3 +#define RTOverRightStrategyNumber 4 +#define RTRightStrategyNumber 5 +#define RTSameStrategyNumber 6 +#define RTContainsStrategyNumber 7 +#define RTContainedByStrategyNumber 8 +#define RTOverBelowStrategyNumber 9 +#define RTBelowStrategyNumber 10 +#define RTAboveStrategyNumber 11 +#define RTOverAboveStrategyNumber 12 + /* * Page opaque data in a GiST index page. */ diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h index 17ef0d7866..da6bc69683 100644 --- a/src/include/access/rmgr.h +++ b/src/include/access/rmgr.h @@ -3,7 +3,7 @@ * * Resource managers definition * - * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.14 2005/06/06 17:01:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/rmgr.h,v 1.15 2005/11/07 17:36:46 tgl Exp $ */ #ifndef RMGR_H #define RMGR_H @@ -23,7 +23,6 @@ typedef uint8 RmgrId; #define RM_HEAP_ID 10 #define RM_BTREE_ID 11 #define RM_HASH_ID 12 -#define RM_RTREE_ID 13 #define RM_GIST_ID 14 #define RM_SEQ_ID 15 #define RM_MAX_ID RM_SEQ_ID diff --git a/src/include/access/rtree.h b/src/include/access/rtree.h deleted file mode 100644 index d5aa103af7..0000000000 --- a/src/include/access/rtree.h +++ /dev/null @@ -1,145 +0,0 @@ -/*------------------------------------------------------------------------- - * - * rtree.h - * common declarations for the rtree access method code. - * - * - * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * $PostgreSQL: pgsql/src/include/access/rtree.h,v 1.41 2005/06/24 20:53:31 tgl Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef RTREE_H -#define RTREE_H - -#include "access/itup.h" -#include "access/sdir.h" -#include "access/skey.h" -#include "access/xlog.h" -#include "utils/rel.h" - -/* see rtstrat.c for what all this is about */ -#define RTNStrategies 12 -#define RTLeftStrategyNumber 1 -#define RTOverLeftStrategyNumber 2 -#define RTOverlapStrategyNumber 3 -#define RTOverRightStrategyNumber 4 -#define RTRightStrategyNumber 5 -#define RTSameStrategyNumber 6 -#define RTContainsStrategyNumber 7 -#define RTContainedByStrategyNumber 8 -#define RTOverBelowStrategyNumber 9 -#define RTBelowStrategyNumber 10 -#define RTAboveStrategyNumber 11 -#define RTOverAboveStrategyNumber 12 - -#define RTNProcs 3 -#define RT_UNION_PROC 1 -#define RT_INTER_PROC 2 -#define RT_SIZE_PROC 3 - -#define F_LEAF (1 << 0) - -typedef struct RTreePageOpaqueData -{ - uint32 flags; -} RTreePageOpaqueData; - -typedef RTreePageOpaqueData *RTreePageOpaque; - -/* - * When we descend a tree, we keep a stack of parent pointers. - */ - -typedef struct RTSTACK -{ - struct RTSTACK *rts_parent; - OffsetNumber rts_child; - BlockNumber rts_blk; -} RTSTACK; - -/* - * When we're doing a scan, we need to keep track of the parent stack - * for the marked and current items. Also, rtrees have the following - * property: if you're looking for the box (1,1,2,2), on the internal - * nodes you have to search for all boxes that *contain* (1,1,2,2), - * and not the ones that match it. We have a private scan key for - * internal nodes in the opaque structure for rtrees for this reason. - * See access/index-rtree/rtscan.c and rtstrat.c for how it gets - * initialized. We also keep pins on the scan's current buffer and - * marked buffer, if any: this avoids the need to invoke ReadBuffer() - * for each tuple produced by the index scan. - */ - -typedef struct RTreeScanOpaqueData -{ - struct RTSTACK *s_stack; - struct RTSTACK *s_markstk; - uint16 s_flags; - int s_internalNKey; - ScanKey s_internalKey; - Buffer curbuf; - Buffer markbuf; -} RTreeScanOpaqueData; - -typedef RTreeScanOpaqueData *RTreeScanOpaque; - -/* - * When we're doing a scan and updating a tree at the same time, the - * updates may affect the scan. We use the flags entry of the scan's - * opaque space to record our actual position in response to updates - * that we can't handle simply by adjusting pointers. - */ - -#define RTS_CURBEFORE ((uint16) (1 << 0)) -#define RTS_MRKBEFORE ((uint16) (1 << 1)) - -/* root page of an rtree */ -#define P_ROOT 0 - -/* - * When we update a relation on which we're doing a scan, we need to - * check the scan and fix it if the update affected any of the pages it - * touches. Otherwise, we can miss records that we should see. The only - * times we need to do this are for deletions and splits. See the code in - * rtscan.c for how the scan is fixed. These two contants tell us what sort - * of operation changed the index. - */ - -#define RTOP_DEL 0 -#define RTOP_SPLIT 1 - -/* defined in rtree.c */ -extern void freestack(RTSTACK *s); - -/* - * RTree code. - * Defined in access/rtree/ - */ -extern Datum rtinsert(PG_FUNCTION_ARGS); -extern Datum rtbulkdelete(PG_FUNCTION_ARGS); -extern Datum rtbeginscan(PG_FUNCTION_ARGS); -extern Datum rtgettuple(PG_FUNCTION_ARGS); -extern Datum rtgetmulti(PG_FUNCTION_ARGS); -extern Datum rtendscan(PG_FUNCTION_ARGS); -extern Datum rtmarkpos(PG_FUNCTION_ARGS); -extern Datum rtrestrpos(PG_FUNCTION_ARGS); -extern Datum rtrescan(PG_FUNCTION_ARGS); -extern Datum rtbuild(PG_FUNCTION_ARGS); -extern void _rtdump(Relation r); - -extern void rtree_redo(XLogRecPtr lsn, XLogRecord *record); -extern void rtree_desc(char *buf, uint8 xl_info, char *rec); - -/* rtscan.c */ -extern void rtadjscans(Relation r, int op, BlockNumber blkno, - OffsetNumber offnum); -extern void ReleaseResources_rtree(void); - -/* rtstrat.c */ -extern StrategyNumber RTMapToInternalOperator(StrategyNumber strat); -extern bool RTMapToInternalNegate(StrategyNumber strat); - -#endif /* RTREE_H */ diff --git a/src/include/access/rtscan.h b/src/include/access/rtscan.h deleted file mode 100644 index 596ec2825c..0000000000 --- a/src/include/access/rtscan.h +++ /dev/null @@ -1,23 +0,0 @@ -/*------------------------------------------------------------------------- - * - * rtscan.h - * routines defined in access/rtree/rtscan.c - * - * - * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * $PostgreSQL: pgsql/src/include/access/rtscan.h,v 1.18 2004/12/31 22:03:21 pgsql Exp $ - * - *------------------------------------------------------------------------- - */ -#ifndef RTSCAN_H -#define RTSCAN_H - -#include "storage/block.h" -#include "storage/off.h" -#include "utils/rel.h" - -void rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum); - -#endif /* RTSCAN_H */ -- cgit v1.2.1