I did some basic profiling of CVS HEAD after having read Bruce's post the
other day: When did we get so fast. It seemed to me that the number of
inserts per second wasn't actually all that high so I had a look at some
numbers:
% cumulative self self totaltime seconds seconds calls s/call s/call name 7.32
3.48 3.48 100004 0.00 0.00 yyparse 4.42 5.58 2.10 1200107 0.00 0.00 SearchCatCache
4.10 7.53 1.95 900020 0.00 0.00 base_yylex 3.85 9.35 1.83 100150 0.00 0.00
XLogInsert3.51 11.02 1.67 600540 0.00 0.00 pgstat_initstats 2.24 12.09 1.07 2208418
0.00 0.00 hash_search 1.86 12.97 0.88 2607669 0.00 0.00 hash_any
I am still researching ways of increasing performance of yacc parsers --
there is a very small amount of information on the Web concerning this --
but pgstat_initstats() caught my eye. This gets called about 6 times per
insert (I did 100000 inserts) and the major cost appears to relate to the
linear pgStatTabstatMessages. The comparative performance of
hash_search() suggests that pgStatTabstatMessages may benefit from use of
a hash. However, it seems unreasonable that we're doing work at all in
pgstat_initstats() if the user is not interested in query/block/tuple
stats.
Comments? Have I missed something?
Thanks,
Gavin