aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-17 23:41:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-17 23:41:51 +0000
commitedf0b5f0db0da14340fa4ea140f5c20003e84fe5 (patch)
tree82ef18a42cf3ab710244879d219c993708540487 /src/backend/access
parentd03a933ec5400f77fc132d4a47bb7d2981ff5187 (diff)
downloadpostgresql-edf0b5f0db0da14340fa4ea140f5c20003e84fe5.tar.gz
postgresql-edf0b5f0db0da14340fa4ea140f5c20003e84fe5.zip
Get rid of IndexIsUniqueNoCache() kluge by the simple expedient of
passing the index-is-unique flag to index build routines (duh! ... why wasn't it done this way to begin with?). Aside from eliminating an eyesore, this should save a few milliseconds in btree index creation because a full scan of pg_index is not needed any more.
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/gist/gist.c11
-rw-r--r--src/backend/access/hash/hash.c11
-rw-r--r--src/backend/access/nbtree/nbtree.c19
-rw-r--r--src/backend/access/rtree/rtree.c11
4 files changed, 22 insertions, 30 deletions
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index e5afa4167fd..4bf737dcd36 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.58 2000/06/15 03:31:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.59 2000/06/17 23:41:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,13 +67,12 @@ gistbuild(PG_FUNCTION_ARGS)
Relation index = (Relation) PG_GETARG_POINTER(1);
int32 natts = PG_GETARG_INT32(2);
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
+ FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
+ PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
#ifdef NOT_USED
- IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
- uint16 pcount = PG_GETARG_UINT16(5);
- Datum *params = (Datum *) PG_GETARG_POINTER(6);
+ bool unique = PG_GETARG_BOOL(6);
+ IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
#endif
- FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
- PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
HeapScanDesc scan;
AttrNumber i;
HeapTuple htup;
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 043e0b891bc..9102b75f61b 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.39 2000/06/14 05:24:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.40 2000/06/17 23:41:13 tgl Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -43,13 +43,12 @@ hashbuild(PG_FUNCTION_ARGS)
Relation index = (Relation) PG_GETARG_POINTER(1);
int32 natts = PG_GETARG_INT32(2);
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
+ FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
+ PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
#ifdef NOT_USED
- IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
- uint16 pcount = PG_GETARG_UINT16(5);
- Datum *params = (Datum *) PG_GETARG_POINTER(6);
+ bool unique = PG_GETARG_BOOL(6);
+ IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
#endif
- FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
- PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
HeapScanDesc hscan;
HeapTuple htup;
IndexTuple itup;
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 22b372d3a9f..59423ccb5f0 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.58 2000/06/15 04:09:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.59 2000/06/17 23:41:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,13 +47,12 @@ btbuild(PG_FUNCTION_ARGS)
Relation index = (Relation) PG_GETARG_POINTER(1);
int32 natts = PG_GETARG_INT32(2);
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
+ FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
+ PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
+ bool unique = PG_GETARG_BOOL(6);
#ifdef NOT_USED
- IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
- uint16 pcount = PG_GETARG_UINT16(5);
- Datum *params = (Datum *) PG_GETARG_POINTER(6);
+ IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
#endif
- FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
- PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
HeapScanDesc hscan;
HeapTuple htup;
IndexTuple itup;
@@ -76,7 +75,6 @@ btbuild(PG_FUNCTION_ARGS)
Node *pred,
*oldPred;
BTSpool *spool = NULL;
- bool isunique;
bool usefast;
/* note that this is a new btree */
@@ -98,9 +96,6 @@ btbuild(PG_FUNCTION_ARGS)
ResetUsage();
#endif /* BTREE_BUILD_STATS */
- /* see if index is unique */
- isunique = IndexIsUniqueNoCache(RelationGetRelid(index));
-
/* initialize the btree index metadata page (if this is a new index) */
if (oldPred == NULL)
_bt_metapinit(index);
@@ -146,7 +141,7 @@ btbuild(PG_FUNCTION_ARGS)
if (usefast)
{
- spool = _bt_spoolinit(index, isunique);
+ spool = _bt_spoolinit(index, unique);
res = (InsertIndexResult) NULL;
}
@@ -254,7 +249,7 @@ btbuild(PG_FUNCTION_ARGS)
if (usefast)
_bt_spool(btitem, spool);
else
- res = _bt_doinsert(index, btitem, isunique, heap);
+ res = _bt_doinsert(index, btitem, unique, heap);
pfree(btitem);
pfree(itup);
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index 513fcd8798b..7e84d456389 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.49 2000/06/14 05:24:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.50 2000/06/17 23:41:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,13 +66,12 @@ rtbuild(PG_FUNCTION_ARGS)
Relation index = (Relation) PG_GETARG_POINTER(1);
int32 natts = PG_GETARG_INT32(2);
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
+ FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
+ PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
#ifdef NOT_USED
- IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
- uint16 pcount = PG_GETARG_UINT16(5);
- Datum *params = (Datum *) PG_GETARG_POINTER(6);
+ bool unique = PG_GETARG_BOOL(6);
+ IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
#endif
- FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
- PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
HeapScanDesc scan;
AttrNumber i;
HeapTuple htup;