1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

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.
This commit is contained in:
Tom Lane
1999-01-24 05:40:49 +00:00
parent 77f5428244
commit d03e98737c
6 changed files with 74 additions and 78 deletions

View File

@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: be-dumpdata.c,v 1.19 1998/12/14 06:50:23 scrappy Exp $
* $Id: be-dumpdata.c,v 1.20 1999/01/24 05:40:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -213,7 +213,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
int i;
Datum attr;
bool isnull;
Oid typoutput;
Oid typoutput,
typelem;
PortalEntry *entry = NULL;
PortalBuffer *portal = NULL;
@@ -298,7 +299,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
for (i = 0; i < tuple->t_data->t_natts; i++)
{
attr = heap_getattr(tuple, i + 1, typeinfo, &isnull);
typoutput = typtoout((Oid) typeinfo->attrs[i]->atttypid);
getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid,
&typoutput, &typelem);
lengths[i] = typeinfo->attrs[i]->attlen;
@@ -311,11 +313,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
}
if (!isnull && OidIsValid(typoutput))
{
values[i] = fmgr(typoutput, attr,
gettypelem(typeinfo->attrs[i]->atttypid),
values[i] = fmgr(typoutput, attr, typelem,
typeinfo->attrs[i]->atttypmod);
}
else
values[i] = NULL;