Unix Technical Forum

improves ExecMakeFunctionResultNoSets

This is a discussion on improves ExecMakeFunctionResultNoSets within the Pgsql Patches forums, part of the PostgreSQL category; --> Attached patch improves ExecMakeFunctionResultNoSets, etc. This patch uses InitFunctionCallInfoData macro instead of MemSet to initialize FunctionCallInfoData. An idea of ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:10 AM
a_ogawa
 
Posts: n/a
Default improves ExecMakeFunctionResultNoSets


Attached patch improves ExecMakeFunctionResultNoSets, etc.

This patch uses InitFunctionCallInfoData macro instead of MemSet to
initialize FunctionCallInfoData.
An idea of this patch discussed in the "FunctionCallN improvement" thread.
(http://archives.postgresql.org/pgsql...1/msg01054.php)
To achieve this, InitFunctionCallInfoData macro was moved from fmgr.c to
fmgr.h.

test sql:
select substr(c.relname, 1, 10) from pg_class c, pg_am, pg_amop;
(There are pg_am and pg_amop only to increase the number of the records.)

result of original code:
-----------------------------------------------------------------------
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
21.43 0.36 0.36 219911 0.00 0.00
ExecMakeFunctionResultNoSets
7.14 0.48 0.12 219912 0.00 0.00 pg_mbstrlen_with_len
6.25 0.58 0.10 1102916 0.00 0.00 AllocSetAlloc
5.36 0.68 0.09 5936448 0.00 0.00 pg_euc_mblen
5.36 0.77 0.09 5936448 0.00 0.00 pg_mblen

result of after patch:
-----------------------------------------------------------------------
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
7.52 0.10 0.10 5936448 0.00 0.00 pg_mblen
7.14 0.20 0.10 1104587 0.00 0.00 AllocSetAlloc
6.77 0.28 0.09 219912 0.00 0.00 text_substring
6.39 0.37 0.09 1547723 0.00 0.00 AllocSetFreeIndex
6.02 0.45 0.08 219912 0.00 0.00 pg_mbstrlen_with_len
4.51 0.51 0.06 5936448 0.00 0.00 pg_euc_mblen
4.51 0.57 0.06 442745 0.00 0.00 ExecProcNode
4.51 0.63 0.06 219911 0.00 0.00
ExecMakeFunctionResultNoSets

regards,

--- Atsushi Ogawa



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:11 AM
Tom Lane
 
Posts: n/a
Default Re: improves ExecMakeFunctionResultNoSets

a_ogawa <a_ogawa@hi-ho.ne.jp> writes:
> This patch uses InitFunctionCallInfoData macro instead of MemSet to
> initialize FunctionCallInfoData.
> An idea of this patch discussed in the "FunctionCallN improvement" thread.
> (http://archives.postgresql.org/pgsql...1/msg01054.php)


Looks good --- applied with minor changes. I figured that if we were
going to make InitFunctionCallInfoData generally available, we had
better fix it to cover initializing the context and resultinfo fields
per caller option. Also cleaned up a couple of other places that
already had hand-optimized calling sequences, and can now be written
more cleanly using the macro. Also, I removed this code you added in
a couple places:

+ /*
+ * argnull is initialized here for safety. Because it might not be
+ * set by ExecEvalExpr.
+ */
+ fcinfo->argnull[i] = false;

If ExecEvalExpr fails to set its isNull argument we will have breakage
all over; there is no need for speed-critical code to assume it has
to do this.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:53 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com