aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/scankey.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-10-06 23:21:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-10-06 23:21:45 +0000
commit85801a4dbdee22f230637311681b8b03a72979db (patch)
tree28054ba90fda332be0d5254e5bdaba5a2a51f1f2 /src/backend/access/common/scankey.c
parenta965750abf2504e266e5071dc90365be9485395a (diff)
downloadpostgresql-85801a4dbdee22f230637311681b8b03a72979db.tar.gz
postgresql-85801a4dbdee22f230637311681b8b03a72979db.zip
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.
Diffstat (limited to 'src/backend/access/common/scankey.c')
-rw-r--r--src/backend/access/common/scankey.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/backend/access/common/scankey.c b/src/backend/access/common/scankey.c
index eb66d41bf26..26112171911 100644
--- a/src/backend/access/common/scankey.c
+++ b/src/backend/access/common/scankey.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.19 2001/06/01 02:41:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.20 2001/10/06 23:21:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -69,3 +69,31 @@ ScanKeyEntryInitialize(ScanKey entry,
Assert(ScanKeyEntryIsLegal(entry));
}
+
+/*
+ * ScanKeyEntryInitializeWithInfo
+ * Initializes a scan key entry using an already-completed FmgrInfo
+ * function lookup record.
+ *
+ * mcxt is the memory context holding the scan key; it'll be used for
+ * any subsidiary info attached to the scankey's FmgrInfo record.
+ */
+void
+ScanKeyEntryInitializeWithInfo(ScanKey entry,
+ bits16 flags,
+ AttrNumber attributeNumber,
+ FmgrInfo *finfo,
+ MemoryContext mcxt,
+ Datum argument)
+{
+ Assert(PointerIsValid(entry));
+ Assert(RegProcedureIsValid(finfo->fn_oid));
+
+ entry->sk_flags = flags;
+ entry->sk_attno = attributeNumber;
+ entry->sk_procedure = finfo->fn_oid;
+ entry->sk_argument = argument;
+ fmgr_info_copy(&entry->sk_func, finfo, mcxt);
+
+ Assert(ScanKeyEntryIsLegal(entry));
+}