mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Rearrange fmgr.c and relcache so that it's possible to keep FmgrInfo
lookup info in the relcache for index access method support functions. This makes a huge difference for dynamically loaded support functions, and should save a few cycles even for built-in ones. Also tweak dfmgr.c so that load_external_function is called only once, not twice, when doing fmgr_info for a dynamically loaded function. All per performance gripe from Teodor Sigaev, 5-Oct-01.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.67 2001/07/15 22:48:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.68 2001/10/06 23:21:43 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -435,7 +435,6 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
BlockNumber blkno;
|
||||
StrategyNumber strat;
|
||||
RetrieveIndexResult res;
|
||||
RegProcedure proc;
|
||||
int32 result;
|
||||
BTScanOpaque so;
|
||||
bool continuescan;
|
||||
@@ -532,6 +531,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
scankeys = (ScanKey) palloc(keysCount * sizeof(ScanKeyData));
|
||||
for (i = 0; i < keysCount; i++)
|
||||
{
|
||||
FmgrInfo *procinfo;
|
||||
|
||||
j = nKeyIs[i];
|
||||
|
||||
/*
|
||||
@@ -545,9 +546,13 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
|
||||
elog(ERROR, "_bt_first: btree doesn't support is(not)null, yet");
|
||||
return ((RetrieveIndexResult) NULL);
|
||||
}
|
||||
proc = index_getprocid(rel, i + 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitialize(scankeys + i, so->keyData[j].sk_flags,
|
||||
i + 1, proc, so->keyData[j].sk_argument);
|
||||
procinfo = index_getprocinfo(rel, i + 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitializeWithInfo(scankeys + i,
|
||||
so->keyData[j].sk_flags,
|
||||
i + 1,
|
||||
procinfo,
|
||||
CurrentMemoryContext,
|
||||
so->keyData[j].sk_argument);
|
||||
}
|
||||
if (nKeyIs)
|
||||
pfree(nKeyIs);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.45 2001/05/17 14:59:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.46 2001/10/06 23:21:43 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
|
||||
TupleDesc itupdesc;
|
||||
int natts;
|
||||
int i;
|
||||
RegProcedure proc;
|
||||
FmgrInfo *procinfo;
|
||||
Datum arg;
|
||||
bool null;
|
||||
bits16 flag;
|
||||
@@ -48,14 +48,15 @@ _bt_mkscankey(Relation rel, IndexTuple itup)
|
||||
|
||||
for (i = 0; i < natts; i++)
|
||||
{
|
||||
proc = index_getprocid(rel, i + 1, BTORDER_PROC);
|
||||
procinfo = index_getprocinfo(rel, i + 1, BTORDER_PROC);
|
||||
arg = index_getattr(itup, i + 1, itupdesc, &null);
|
||||
flag = null ? SK_ISNULL : 0x0;
|
||||
ScanKeyEntryInitialize(&skey[i],
|
||||
flag,
|
||||
(AttrNumber) (i + 1),
|
||||
proc,
|
||||
arg);
|
||||
ScanKeyEntryInitializeWithInfo(&skey[i],
|
||||
flag,
|
||||
(AttrNumber) (i + 1),
|
||||
procinfo,
|
||||
CurrentMemoryContext,
|
||||
arg);
|
||||
}
|
||||
|
||||
return skey;
|
||||
@@ -76,7 +77,7 @@ _bt_mkscankey_nodata(Relation rel)
|
||||
ScanKey skey;
|
||||
int natts;
|
||||
int i;
|
||||
RegProcedure proc;
|
||||
FmgrInfo *procinfo;
|
||||
|
||||
natts = RelationGetNumberOfAttributes(rel);
|
||||
|
||||
@@ -84,12 +85,13 @@ _bt_mkscankey_nodata(Relation rel)
|
||||
|
||||
for (i = 0; i < natts; i++)
|
||||
{
|
||||
proc = index_getprocid(rel, i + 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitialize(&skey[i],
|
||||
SK_ISNULL,
|
||||
(AttrNumber) (i + 1),
|
||||
proc,
|
||||
(Datum) NULL);
|
||||
procinfo = index_getprocinfo(rel, i + 1, BTORDER_PROC);
|
||||
ScanKeyEntryInitializeWithInfo(&skey[i],
|
||||
SK_ISNULL,
|
||||
(AttrNumber) (i + 1),
|
||||
procinfo,
|
||||
CurrentMemoryContext,
|
||||
(Datum) 0);
|
||||
}
|
||||
|
||||
return skey;
|
||||
|
||||
Reference in New Issue
Block a user