Performance of Parser?

From: Jignesh Shah <J(dot)K(dot)Shah(at)Sun(dot)COM>
To: pgsql-performance(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Performance of Parser?
Date: 2007-01-13 23:38:24
Message-ID: 45A96D70.90506@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Hello All,

I am using the latest 8.2 source that I compiled with Sun Studio 11 and
tested it on Solaris 10 11/06 against an app server. I find that the CPU
utilization was higher than I expected and started digging through it.

Aparently the top CPU usage comes from the following stack trace which
is roughly about 10-15% of the total the postgresql uses.

Anyway a real developer might make more sense from this than I can

libc_psr.so.1`memcpy+0x524
postgres`SearchCatCache+0x24
postgres`getBaseType+0x2c
postgres`find_coercion_pathway+0x14
postgres`can_coerce_type+0x58
postgres`func_match_argtypes+0x24
postgres`oper_select_candidate+0x14
postgres`make_op+0x1a8
postgres`transformAExprAnd+0x1c
postgres`transformWhereClause+0x18
postgres`transformUpdateStmt+0x94
postgres`transformStmt+0x1dc
postgres`do_parse_analyze+0x18
postgres`parse_analyze_varparams+0x30
postgres`exec_parse_message+0x2fc
postgres`PostgresMain+0x117c
postgres`BackendRun+0x248
postgres`BackendStartup+0xf4
postgres`ServerLoop+0x4c8
postgres`PostmasterMain+0xca0

FUNCTION COUNT PCNT
postgres`can_coerce_type 1 0.1%
postgres`find_coercion_pathway 11 0.9%
postgres`SearchCatCache 43 3.4%
libc_psr.so.1`memcpy 136 10.6%

The appserver is basically using bunch of prepared statements that the
server should be executing directly without doing the parsing again.
Since it is the parser module that invokes the catalog search, does
anybody know how to improve the can_coerce_type function in order to
reduce the similar comparisions again and again for same type of statements.

I also wanted to check if postgresql stores prepared statements at the
server level or does it parse each incoming prepared statement again?

Any insight will help here in understanding what it is attempting to do
and what can be the possible workarounds.

Regards,
Jignesh

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message elein 2007-01-14 00:05:43 Re: [HACKERS] Autovacuum Improvements
Previous Message Peter Eisentraut 2007-01-13 22:18:59 Memory context in exception handler

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-01-14 00:24:28 Re: Performance of Parser?
Previous Message Daniel Cristian Cruz 2007-01-13 15:55:35 Re: Large table performance