aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeUnique.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-01-24 05:40:49 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-01-24 05:40:49 +0000
commitd03e98737c5aec12332bbbaf12abe2e2642048c4 (patch)
tree21f1014417e0ffa0fed7d560615a584e18ebffa9 /src/backend/executor/nodeUnique.c
parent77f54282441584f539186d1e9054544f89e0e9b4 (diff)
downloadpostgresql-d03e98737c5aec12332bbbaf12abe2e2642048c4.tar.gz
postgresql-d03e98737c5aec12332bbbaf12abe2e2642048c4.zip
Replace typtoout() and gettypelem() with a single routine,
so that fetching an attribute value needs only one SearchSysCacheTuple call instead of two redundant searches. This speeds up a large SELECT by about ten percent, and probably will help GROUP BY and SELECT DISTINCT too.
Diffstat (limited to 'src/backend/executor/nodeUnique.c')
-rw-r--r--src/backend/executor/nodeUnique.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index c04c44fa0d1..999362ab69d 100644
--- a/src/backend/executor/nodeUnique.c
+++ b/src/backend/executor/nodeUnique.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.18 1998/11/27 19:52:03 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.19 1999/01/24 05:40:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@
#include "executor/nodeUnique.h"
#include "optimizer/clauses.h"
#include "access/heapam.h"
-#include "access/printtup.h" /* for typtoout() */
+#include "access/printtup.h" /* for getTypeOutAndElem() */
#include "utils/builtins.h" /* for namecpy() */
/* ----------------------------------------------------------------
@@ -117,7 +117,8 @@ ExecUnique(Unique *node)
char *uniqueAttr;
AttrNumber uniqueAttrNum;
TupleDesc tupDesc;
- Oid typoutput;
+ Oid typoutput,
+ typelem;
/* ----------------
* get information from the node
@@ -132,12 +133,14 @@ ExecUnique(Unique *node)
if (uniqueAttr)
{
tupDesc = ExecGetResultType(uniquestate);
- typoutput = typtoout((Oid) tupDesc->attrs[uniqueAttrNum - 1]->atttypid);
+ getTypeOutAndElem((Oid) tupDesc->attrs[uniqueAttrNum - 1]->atttypid,
+ &typoutput, &typelem);
}
else
{ /* keep compiler quiet */
tupDesc = NULL;
- typoutput = 0;
+ typoutput = InvalidOid;
+ typelem = InvalidOid;
}
/* ----------------
@@ -196,11 +199,9 @@ ExecUnique(Unique *node)
{
if (isNull1) /* both are null, they are equal */
continue;
- val1 = fmgr(typoutput, attr1,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ val1 = fmgr(typoutput, attr1, typelem,
tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
- val2 = fmgr(typoutput, attr2,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ val2 = fmgr(typoutput, attr2, typelem,
tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
/*