Re: [JDBC] Prepared statement performance...

From: Barry Lind <barry(at)xythos(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>, Dave Cramer <Dave(at)micro-automation(dot)net>, Peter Kovacs <peter(dot)kovacs(at)sysdata(dot)siemens(dot)hu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] Prepared statement performance...
Date: 2002-09-27 19:29:00
Message-ID: 3D94B17C.3020203@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Dmitry Tkach wrote:
>
> I have to disagree with that too, based on my experience...
> In that application I mentioned in the topic that initiated this
> discussion, the statement, that I have to execute about 30 million times
> looks like
>
> "select * from foo where primary_key=bar"
>
> What could possibly be simpler than that? :-)
> I was surprised to find out however, that in the end the backend turns
> out to have *more* time parsing and planning that query then actually
> executing it :-(
>

I don't disagree that this is a simple query. But remember that since
the implementation of server side prepare is through the sql interface
with each call to execute this statement you still need to issue the
following sql statement: execute <name>(bar); which will still need to
invoke the parser. Using server side prepared statements doesn't
eliminate all parses. It isn't true that you can just take the original
execute time of a statement and assume that with server side prepared
statements the total time will be the same as that, it will be more.

Executing something 30million times will certainly make even a little
improvement for a simple statement like this noticable, but 30million
executes of the same statement certainly isn't the norm. And I would
suggest it is the type of environment where serverside prepared
statements are the most useful. I hope you can try the new
functionality and provide us all with real numbers as to how much it helps.

thanks,
--Barry

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-09-27 19:32:41 Re: cache state reset
Previous Message Barry Lind 2002-09-27 19:16:41 Re: [JDBC] Prepared statement performance...

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-09-27 20:04:55 Re: [JDBC] Prepared statement performance...
Previous Message Barry Lind 2002-09-27 19:16:41 Re: [JDBC] Prepared statement performance...