Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite27f879

Browse files
committed
Turns out it's easy to cache the fmgr function lookup
result, too ... another little bit of speed for SELECT.
1 parent422221c commite27f879

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/access/common/printtup.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.40 1999/01/2700:36:22 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.41 1999/01/2701:11:43 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -75,7 +75,7 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem)
7575
typedefstruct {/* Per-attribute information */
7676
Oidtypoutput;/* Oid for the attribute's type output fn */
7777
Oidtypelem;/* typelem value to pass to the output fn */
78-
/*more soon... */
78+
FmgrInfofinfo;/*Precomputed call info for typoutput */
7979
}PrinttupAttrInfo;
8080

8181
typedefstruct {
@@ -138,8 +138,9 @@ printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs)
138138
for (i=0;i<numAttrs;i++)
139139
{
140140
PrinttupAttrInfo*thisState=myState->myinfo+i;
141-
getTypeOutAndElem((Oid)typeinfo->attrs[i]->atttypid,
142-
&thisState->typoutput,&thisState->typelem);
141+
if (getTypeOutAndElem((Oid)typeinfo->attrs[i]->atttypid,
142+
&thisState->typoutput,&thisState->typelem))
143+
fmgr_info(thisState->typoutput,&thisState->finfo);
143144
}
144145
}
145146

@@ -200,15 +201,14 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
200201
*/
201202
for (i=0;i<tuple->t_data->t_natts;++i)
202203
{
204+
PrinttupAttrInfo*thisState=myState->myinfo+i;
203205
attr=heap_getattr(tuple,i+1,typeinfo,&isnull);
204206
if (isnull)
205207
continue;
206-
if (OidIsValid(myState->myinfo[i].typoutput))
208+
if (OidIsValid(thisState->typoutput))
207209
{
208-
outputstr=fmgr(myState->myinfo[i].typoutput,
209-
attr,
210-
myState->myinfo[i].typelem,
211-
typeinfo->attrs[i]->atttypmod);
210+
outputstr= (char*) (*fmgr_faddr(&thisState->finfo))
211+
(attr,thisState->typelem,typeinfo->attrs[i]->atttypmod);
212212
#ifdefMULTIBYTE
213213
p=pg_server_to_client(outputstr,strlen(outputstr));
214214
outputlen=strlen(p);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp