1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* index.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* prototypes for index.c.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2004-12-31 23:04:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2005-03-16 22:38:10 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/catalog/index.h,v 1.60 2005/03/16 21:38:09 tgl Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef INDEX_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define INDEX_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "access/itup.h"
|
2002-02-19 21:11:20 +01:00
|
|
|
#include "catalog/pg_index.h"
|
1999-07-16 19:07:40 +02:00
|
|
|
#include "nodes/execnodes.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2003-05-28 18:04:02 +02:00
|
|
|
|
2002-03-10 07:02:24 +01:00
|
|
|
#define DEFAULT_INDEX_TYPE "btree"
|
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.
2001-07-16 00:48:19 +02:00
|
|
|
|
|
|
|
/* Typedef for callback function for IndexBuildHeapScan */
|
|
|
|
typedef void (*IndexBuildCallback) (Relation index,
|
2001-10-25 07:50:21 +02:00
|
|
|
HeapTuple htup,
|
|
|
|
Datum *attdata,
|
|
|
|
char *nulls,
|
|
|
|
bool tupleIsAlive,
|
|
|
|
void *state);
|
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.
2001-07-16 00:48:19 +02:00
|
|
|
|
|
|
|
|
2002-03-26 20:17:02 +01:00
|
|
|
extern Oid index_create(Oid heapRelationId,
|
2002-03-31 08:26:32 +02:00
|
|
|
const char *indexRelationName,
|
2001-03-22 05:01:46 +01:00
|
|
|
IndexInfo *indexInfo,
|
|
|
|
Oid accessMethodObjectId,
|
2004-06-18 08:14:31 +02:00
|
|
|
Oid tableSpaceId,
|
2001-03-22 05:01:46 +01:00
|
|
|
Oid *classObjectId,
|
|
|
|
bool primary,
|
2002-07-12 20:43:19 +02:00
|
|
|
bool isconstraint,
|
2004-05-05 06:48:48 +02:00
|
|
|
bool allow_system_table_mods,
|
|
|
|
bool skip_build);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-12-10 04:56:14 +01:00
|
|
|
extern void index_drop(Oid indexId);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2003-05-28 18:04:02 +02:00
|
|
|
extern IndexInfo *BuildIndexInfo(Relation index);
|
2000-07-15 00:18:02 +02:00
|
|
|
|
|
|
|
extern void FormIndexDatum(IndexInfo *indexInfo,
|
2005-03-16 22:38:10 +01:00
|
|
|
TupleTableSlot *slot,
|
2003-05-28 18:04:02 +02:00
|
|
|
EState *estate,
|
2001-03-22 05:01:46 +01:00
|
|
|
Datum *datum,
|
|
|
|
char *nullv);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2001-05-07 02:43:27 +02:00
|
|
|
extern void UpdateStats(Oid relid, double reltuples);
|
2003-09-24 20:54:02 +02:00
|
|
|
|
2001-08-10 20:57:42 +02:00
|
|
|
extern void setRelhasindex(Oid relid, bool hasindex,
|
2001-10-25 07:50:21 +02:00
|
|
|
bool isprimary, Oid reltoastidxid);
|
2001-03-22 05:01:46 +01:00
|
|
|
|
2000-12-08 07:17:58 +01:00
|
|
|
extern void setNewRelfilenode(Relation relation);
|
2001-03-22 05:01:46 +01:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
extern void index_build(Relation heapRelation, Relation indexRelation,
|
2001-10-25 07:50:21 +02:00
|
|
|
IndexInfo *indexInfo);
|
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.
2001-07-16 00:48:19 +02:00
|
|
|
|
|
|
|
extern double IndexBuildHeapScan(Relation heapRelation,
|
2001-10-25 07:50:21 +02:00
|
|
|
Relation indexRelation,
|
|
|
|
IndexInfo *indexInfo,
|
|
|
|
IndexBuildCallback callback,
|
|
|
|
void *callback_state);
|
1996-11-13 21:56:15 +01:00
|
|
|
|
2003-09-24 20:54:02 +02:00
|
|
|
extern void reindex_index(Oid indexId);
|
2004-05-08 02:34:49 +02:00
|
|
|
extern bool reindex_relation(Oid relid, bool toast_too);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* INDEX_H */
|