Scott Cain <cain@cshl.org> writes:
> I see, encoding is a per database option. Since I've never set it, all
> my databases use sql_ascii.
Okay, then you've dodged the obvious bullet; time to try profiling I
guess. The way I usually do it is (given a clean, configured source
tree):
cd src/backend
gmake PROFILE="-pg -DLINUX_PROFILE" all
install resulting postgres executable
(The -DLINUX_PROFILE is unnecessary on non-Linux machines, but AFAIK it
won't hurt anything either.) Once you have this installed, each session
will end by dumping a gmon.out profile file into the $PGDATA/base/nnn
directory for its database. After you've done a test run, you do
gprof path/to/postgres/executable path/to/gmon.out >outputfile
and voila, you have a profile.
It's a good idea to make sure that you accumulate a fair amount of CPU
time in a test session, since the profile depends on statistical
sampling. I like to have about a minute of accumulated runtime before
trusting the results. Repeat the same query multiple times if needed.
regards, tom lane