1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

Cleanup of code for creating index entries. Functional indexes with

pass-by-ref data types --- eg, an index on lower(textfield) --- no longer
leak memory during index creation or update.  Clean up a lot of redundant
code ... did you know that copy, vacuum, truncate, reindex, extend index,
and bootstrap each basically duplicated the main executor's logic for
extracting information about an index and preparing index entries?
Functional indexes should be a little faster now too, due to removal
of repeated function lookups.
CREATE INDEX 'opt_type' clause is deimplemented by these changes,
but I haven't removed it from the parser yet (need to merge with
Thomas' latest change set first).
This commit is contained in:
Tom Lane
2000-07-14 22:18:02 +00:00
parent a30bc7c75a
commit 6bfe64032e
32 changed files with 901 additions and 1737 deletions

View File

@@ -1,43 +0,0 @@
/*-------------------------------------------------------------------------
*
* funcindex.h
*
*
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: funcindex.h,v 1.9 2000/01/26 05:57:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef _FUNC_INDEX_INCLUDED_
#define _FUNC_INDEX_INCLUDED_
typedef struct
{
int nargs;
Oid arglist[FUNC_MAX_ARGS];
Oid procOid;
NameData funcName;
} FuncIndexInfo;
typedef FuncIndexInfo *FuncIndexInfoPtr;
/*
* some marginally useful macro definitions
*/
/* #define FIgetname(FINFO) (&((FINFO)->funcName.data[0]))*/
#define FIgetname(FINFO) (FINFO)->funcName.data
#define FIgetnArgs(FINFO) (FINFO)->nargs
#define FIgetProcOid(FINFO) (FINFO)->procOid
#define FIgetArg(FINFO, argnum) (FINFO)->arglist[argnum]
#define FIgetArglist(FINFO) (FINFO)->arglist
#define FIsetnArgs(FINFO, numargs) ((FINFO)->nargs = numargs)
#define FIsetProcOid(FINFO, id) ((FINFO)->procOid = id)
#define FIsetArg(FINFO, argnum, argtype) ((FINFO)->arglist[argnum] = argtype)
#define FIisFunctionalIndex(FINFO) (FINFO->procOid != InvalidOid)
#endif /* FUNCINDEX_H */

View File

@@ -7,14 +7,13 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: genam.h,v 1.23 2000/01/26 05:57:50 momjian Exp $
* $Id: genam.h,v 1.24 2000/07/14 22:17:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef GENAM_H
#define GENAM_H
#include "access/funcindex.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"
@@ -42,9 +41,6 @@ extern RetrieveIndexResult index_getnext(IndexScanDesc scan,
extern RegProcedure index_cost_estimator(Relation relation);
extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
extern Datum GetIndexValue(HeapTuple tuple, TupleDesc hTupDesc,
int attOff, AttrNumber *attrNums, FuncIndexInfo *fInfo,
bool *attNull);
/* in genam.c */
extern IndexScanDesc RelationGetIndexScan(Relation relation, bool scanFromEnd,

View File

@@ -12,7 +12,6 @@
#ifndef GIST_H
#define GIST_H
#include "access/funcindex.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: hash.h,v 1.34 2000/06/19 03:54:35 tgl Exp $
* $Id: hash.h,v 1.35 2000/07/14 22:17:53 tgl Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
@@ -17,7 +17,6 @@
#ifndef HASH_H
#define HASH_H
#include "access/funcindex.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: istrat.h,v 1.17 2000/06/08 22:37:36 momjian Exp $
* $Id: istrat.h,v 1.18 2000/07/14 22:17:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,9 +56,12 @@ extern StrategyNumber RelationGetStrategy(Relation relation,
AttrNumber attributeNumber, StrategyEvaluation evaluation,
RegProcedure procedure);
extern void IndexSupportInitialize(IndexStrategy indexStrategy,
RegProcedure *indexSupport, Oid indexObjectId,
Oid accessMethodObjectId, StrategyNumber maxStrategyNumber,
StrategyNumber maxSupportNumber, AttrNumber maxAttributeNumber);
RegProcedure *indexSupport,
bool *isUnique,
Oid indexObjectId,
Oid accessMethodObjectId,
StrategyNumber maxStrategyNumber,
StrategyNumber maxSupportNumber,
AttrNumber maxAttributeNumber);
#endif /* ISTRAT_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: itup.h,v 1.24 2000/03/17 02:36:37 tgl Exp $
* $Id: itup.h,v 1.25 2000/07/14 22:17:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,18 +61,6 @@ typedef struct RetrieveIndexResultData
typedef RetrieveIndexResultData *RetrieveIndexResult;
/*-----------------
* PredInfo -
* used for partial indices
*-----------------
*/
typedef struct PredInfo
{
Node *pred;
Node *oldPred;
} PredInfo;
/* ----------------
* externs
* ----------------