summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/lsyscache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-11 17:27:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-11 17:27:14 +0000
commit0cc0d0822ddf8e76ed3b7d16ad500762b2ed43dd (patch)
tree77705c6620adbec650660defb4ad56eb65ceeb47 /src/backend/utils/cache/lsyscache.c
parent07e6f93d6b41aaacaf5d2bf758f52ef37f0a6e5b (diff)
Document that get_attstatsslot/free_attstatsslot only need to be passed
valid type information if they are asked to fetch the values part of a pg_statistic slot; these arguments are unneeded if fetching only the numbers part. Use this to save a catcache lookup in btcostestimate, which is looking like a bit of a hotspot in recent profiling. Not a big savings, but since it's essentially free, might as well do it.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r--src/backend/utils/cache/lsyscache.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 6b1646b896d..ebb884dc258 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.127 2005/08/12 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/lsyscache.c,v 1.128 2005/10/11 17:27:14 tgl Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -1841,8 +1841,8 @@ get_attavgwidth(Oid relid, AttrNumber attnum)
* entry, and we don't want to repeat the cache lookup unnecessarily.
*
* statstuple: pg_statistics tuple to be examined.
- * atttype: type OID of attribute.
- * atttypmod: typmod of attribute.
+ * atttype: type OID of attribute (can be InvalidOid if values == NULL).
+ * atttypmod: typmod of attribute (can be 0 if values == NULL).
* reqkind: STAKIND code for desired statistics slot kind.
* reqop: STAOP value wanted, or InvalidOid if don't care.
* values, nvalues: if not NULL, the slot's stavalues are extracted.
@@ -1960,6 +1960,12 @@ get_attstatsslot(HeapTuple statstuple,
return true;
}
+/*
+ * free_attstatsslot
+ * Free data allocated by get_attstatsslot
+ *
+ * atttype need be valid only if values != NULL.
+ */
void
free_attstatsslot(Oid atttype,
Datum *values, int nvalues,