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.
This commit is contained in:
Tom Lane
2000-06-17 23:41:51 +00:00
parent d03a933ec5
commit edf0b5f0db
13 changed files with 89 additions and 160 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: bootstrap.h,v 1.17 2000/01/26 05:57:53 momjian Exp $
* $Id: bootstrap.h,v 1.18 2000/06/17 23:41:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -34,14 +34,11 @@ extern int numattr;
extern int DebugMode;
extern int BootstrapMain(int ac, char *av[]);
extern void index_register(char *heap,
char *ind,
int natts,
AttrNumber *attnos,
uint16 nparams,
Datum *params,
FuncIndexInfo *finfo,
PredInfo *predInfo);
extern void index_register(char *heap, char *ind,
int natts, AttrNumber *attnos,
FuncIndexInfo *finfo, PredInfo *predInfo,
bool unique);
extern void err_out(void);
extern void InsertOneTuple(Oid objectid);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: index.h,v 1.24 2000/06/08 22:37:39 momjian Exp $
* $Id: index.h,v 1.25 2000/06/17 23:41:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -33,8 +33,6 @@ extern void index_create(char *heapRelationName,
int numatts,
AttrNumber *attNums,
Oid *classObjectId,
uint16 parameterCount,
Datum *parameter,
Node *predicate,
bool islossy,
bool unique,
@ -57,12 +55,11 @@ extern void FillDummyExprContext(ExprContext *econtext, TupleTableSlot *slot,
TupleDesc tupdesc, Buffer buffer);
extern void index_build(Relation heapRelation, Relation indexRelation,
int numberOfAttributes, AttrNumber *attributeNumber,
uint16 parameterCount, Datum *parameter, FuncIndexInfo *funcInfo,
PredInfo *predInfo);
int numberOfAttributes, AttrNumber *attributeNumber,
FuncIndexInfo *funcInfo, PredInfo *predInfo,
bool unique);
extern bool IndexIsUnique(Oid indexId);
extern bool IndexIsUniqueNoCache(Oid indexId);
extern bool reindex_index(Oid indexId, bool force);
extern bool activate_indexes_of_a_table(Oid relid, bool activate);

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.139 2000/06/13 07:35:19 tgl Exp $
* $Id: pg_proc.h,v 1.140 2000/06/17 23:41:51 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@ -677,7 +677,7 @@ DATA(insert OID = 321 ( rtdelete PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100
DESCR("r-tree(internal)");
DATA(insert OID = 322 ( rtgettuple PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100 rtgettuple - ));
DESCR("r-tree(internal)");
DATA(insert OID = 323 ( rtbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 rtbuild - ));
DATA(insert OID = 323 ( rtbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 rtbuild - ));
DESCR("r-tree(internal)");
DATA(insert OID = 324 ( rtbeginscan PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100 rtbeginscan - ));
DESCR("r-tree(internal)");
@ -706,7 +706,7 @@ DATA(insert OID = 336 ( btmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
DESCR("btree(internal)");
DATA(insert OID = 337 ( btrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 btrestrpos - ));
DESCR("btree(internal)");
DATA(insert OID = 338 ( btbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 btbuild - ));
DATA(insert OID = 338 ( btbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 btbuild - ));
DESCR("btree(internal)");
DATA(insert OID = 339 ( poly_same PGUID 11 f t t t 2 f 16 "604 604" 100 0 1 0 poly_same - ));
@ -814,7 +814,7 @@ DATA(insert OID = 446 ( hashmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
DESCR("hash(internal)");
DATA(insert OID = 447 ( hashrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 hashrestrpos - ));
DESCR("hash(internal)");
DATA(insert OID = 448 ( hashbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 hashbuild - ));
DATA(insert OID = 448 ( hashbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 hashbuild - ));
DESCR("hash(internal)");
DATA(insert OID = 449 ( hashint2 PGUID 12 f t t t 1 f 23 "21" 100 0 0 100 hashint2 - ));
DESCR("hash");
@ -1040,7 +1040,7 @@ DATA(insert OID = 780 ( gistmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
DESCR("gist(internal)");
DATA(insert OID = 781 ( gistrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 gistrestrpos - ));
DESCR("gist(internal)");
DATA(insert OID = 782 ( gistbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 gistbuild - ));
DATA(insert OID = 782 ( gistbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 gistbuild - ));
DESCR("gist(internal)");
DATA(insert OID = 784 ( tintervaleq PGUID 12 f t f t 2 f 16 "704 704" 100 0 0 100 tintervaleq - ));