diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-01-24 05:40:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-01-24 05:40:49 +0000 |
commit | d03e98737c5aec12332bbbaf12abe2e2642048c4 (patch) | |
tree | 21f1014417e0ffa0fed7d560615a584e18ebffa9 /src/backend/executor/spi.c | |
parent | 77f54282441584f539186d1e9054544f89e0e9b4 (diff) | |
download | postgresql-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/spi.c')
-rw-r--r-- | src/backend/executor/spi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 125a36241ad..5620cf78916 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -3,7 +3,7 @@ * spi.c-- * Server Programming Interface * - * $Id: spi.c,v 1.29 1998/12/14 05:18:51 scrappy Exp $ + * $Id: spi.c,v 1.30 1999/01/24 05:40:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -409,7 +409,8 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) { Datum val; bool isnull; - Oid foutoid; + Oid foutoid, + typelem; SPI_result = 0; if (tuple->t_data->t_natts < fnumber || fnumber <= 0) @@ -421,15 +422,14 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) val = heap_getattr(tuple, fnumber, tupdesc, &isnull); if (isnull) return NULL; - foutoid = typtoout((Oid) tupdesc->attrs[fnumber - 1]->atttypid); - if (!OidIsValid(foutoid)) + if (! getTypeOutAndElem((Oid) tupdesc->attrs[fnumber - 1]->atttypid, + &foutoid, &typelem)) { SPI_result = SPI_ERROR_NOOUTFUNC; return NULL; } - return (fmgr(foutoid, val, - gettypelem(tupdesc->attrs[fnumber - 1]->atttypid), + return (fmgr(foutoid, val, typelem, tupdesc->attrs[fnumber - 1]->atttypmod)); } |