Re: insert performance for win32

Lists: pgsql-performance
From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: insert performance for win32
Date: 2005-11-04 16:16:45
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3417DD7CE@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

ok, here is gprof output from newlines/no newlines
[newlines]
% cumulative self self total
time seconds seconds calls s/call s/call name
19.03 0.67 0.67 1 0.67 3.20 MainLoop
17.61 1.29 0.62 500031 0.00 0.00 yylex
15.63 1.84 0.55 1500094 0.00 0.00 GetVariable
11.08 2.23 0.39 250018 0.00 0.00 SendQuery
4.26 2.38 0.15 750051 0.00 0.00 GetVariableBool
3.41 2.50 0.12 250024 0.00 0.00 SetVariable
2.56 2.59 0.09 250015 0.00 0.00 gets_fromFile
2.27 2.67 0.08 750044 0.00 0.00
yy_switch_to_buffer
2.27 2.75 0.08 500031 0.00 0.00 psql_scan
2.27 2.83 0.08 pg_strcasecmp
1.70 2.89 0.06 4250078 0.00 0.00 emit
1.70 2.95 0.06 500031 0.00 0.00 VariableEquals
1.70 3.01 0.06 250018 0.00 0.00 AcceptResult
1.42 3.06 0.05 250018 0.00 0.00 ResetCancelConn

[no newlines]
% cumulative self self total
time seconds seconds calls s/call s/call name
23.01 0.26 0.26 250019 0.00 0.00 yylex
19.47 0.48 0.22 250018 0.00 0.00 SendQuery
11.50 0.61 0.13 1000070 0.00 0.00 GetVariable
9.73 0.72 0.11 250042 0.00 0.00 pg_strdup
9.73 0.83 0.11 250024 0.00 0.00 SetVariable
6.19 0.90 0.07 500039 0.00 0.00 GetVariableBool
5.31 0.96 0.06 pg_strcasecmp
4.42 1.01 0.05 4250078 0.00 0.00 emit
2.65 1.04 0.03 1 0.03 1.01 MainLoop

ok, mingw gprof is claiming MainLoop is a culprit here, along with
general efficiency penalty otherwise in several things (twice many calls
to yylex, 33%more to getvariable, etc). Just for fun I double checked
string len of query input to SendQuery and everything is the right
length.

Same # calls to SendQuery, but 2.5 times call time in newlines
case...anything jump out?

Merlin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: insert performance for win32
Date: 2005-11-04 16:33:52
Message-ID: 14316.1131122032@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance

"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> writes:
> ok, mingw gprof is claiming MainLoop is a culprit here,

The only thing I can see that would be different for Windows is the
SetConsoleCtrlHandler kernel call ... could that be expensive? Why
do we have either sigsetjmp or setup_cancel_handler inside the per-line
loop, rather than just before it?

There is a lot of stuff in MainLoop that doesn't seem like it really
needs to be done on every single line, particularly not the repeated
fetching of psql variables that couldn't possibly change except inside
HandleSlashCmds. But that all ought to be the same on Unix or Windows.

regards, tom lane


From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: insert performance for win32
Date: 2005-11-04 18:30:34
Message-ID: dkg9bt$fjj$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-performance


""Merlin Moncure"" <merlin(dot)moncure(at)rcsonline(dot)com> wrote
> ok, here is gprof output from newlines/no newlines
> [newlines]
> % cumulative self self total
> time seconds seconds calls s/call s/call name
> 19.03 0.67 0.67 1 0.67 3.20 MainLoop
> 17.61 1.29 0.62 500031 0.00 0.00 yylex
> 15.63 1.84 0.55 1500094 0.00 0.00 GetVariable
> 11.08 2.23 0.39 250018 0.00 0.00 SendQuery
> 4.26 2.38 0.15 750051 0.00 0.00 GetVariableBool
> 3.41 2.50 0.12 250024 0.00 0.00 SetVariable
> 2.56 2.59 0.09 250015 0.00 0.00 gets_fromFile
> 2.27 2.67 0.08 750044 0.00 0.00
> yy_switch_to_buffer
> 2.27 2.75 0.08 500031 0.00 0.00 psql_scan
> 2.27 2.83 0.08 pg_strcasecmp
> 1.70 2.89 0.06 4250078 0.00 0.00 emit
> 1.70 2.95 0.06 500031 0.00 0.00 VariableEquals
> 1.70 3.01 0.06 250018 0.00 0.00 AcceptResult
> 1.42 3.06 0.05 250018 0.00 0.00 ResetCancelConn
>

Maybe I missed some threads .... do you think it is interesting to test the
*absoulte* time difference of the same machine on Windows/Linux by using
timeit.c? I wonder if windows is slower than Linux ...

Regards,
Qingqing